2๐
โ
You could use a computed property so it would automatically adjust when lastUpdate
changes:
export default{
data: function(){
return{
lastUpdate: "10/30/3033",
servers: ['Blue', 'Aphex', 'Maxamillion', 'T180', 'T190', 'NW0']
};
},
components: {
'mi-single-server': SingleServer
},
computed: {
message: function(){
return 'Servers last updated: ' + this.lastUpdate
}
}
}
Then you can use it like you would as if it was in data
, but you would have to change your event to update lastUpdate
instead of message
.
๐คScopey
1๐
You can update data
property using created
hook
export default{
data: function(){
return{
lastUpdate: "10/30/3033",
servers: ['Blue', 'Aphex', 'Maxamillion', 'T180', 'T190', 'NW0'],
message: 'Servers last updated: '
};
},
components: {
'mi-single-server': SingleServer
},
created: function(){
this.message = 'Servers last updated: ' + this.lastUpdate
}
}
Or you can also use mounted
hook instead of created
hook
๐คMuthu Kumaran
Source:stackexchange.com