【发布时间】:2018-08-14 02:13:35
【问题描述】:
当我运行这个时,我得到一个错误:“Uncaught TypeError: this.thePerson is not a function”:
var myApp = new Vue({
el: "#app",
data: {
person: [this.thePerson()]
},
methods: {
thePerson: function() {
return {
personNickname: "Bob",
personOwes: 0,
paymentType: {
card: true,
cash: false
}
};
}
}
});
我不知道为什么!
附:我意识到这是看起来很奇怪的代码,但我使用函数返回数组内容是有原因的......
【问题讨论】:
标签: javascript vue.js