-7
rated 0 times
[
0]
[
7]
/ answers: 1 / hits: 16954
/ 7 Years ago, thu, october 19, 2017, 12:00:00
I'm trying to modify the data that stored in vuejs by using $set
function. But I got this error: TypeError: app.messageBox.$set is not a function.
Here is the code about how I define app and messageBox:
app = new Vue({
el: '#app',
data: {
messageBox: [{
id: 1,
message: 'first'
}, {
id: 2,
message: 'second'
}]
}
});
and in another js file, I try to modify the data in messageBox:
function test() {
app.messageBox.$set(0, {message: 'aaa'});
}
More From » vue.js