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/