1
当点击start方法“增量”变“点击”的变化,但为什么它不会改变“计数器”。应该是因为我在计数器函数中引用了“clicks”变量。Vue公司2.0 - 计算问题
new Vue({
el: '#app',
data: {
title: 'helloworld',
cssClass: '',
clicks: 0,
counter: 0
},
methods: {
changeTitle() {
this.title = 'helloworld new';
},
increment() {
this.clicks++;
}
},
computed: {
counter() {
return this.clicks * 2;
}
}
});
https://jsfiddle.net/freeq343/b7fyeyxm/