v-model 雙向綁定數據,v-model=“data”寫在html的表單標簽中,計算屬性中的函數有get和set的雙向綁定數據方法,所以可以將v-model的值作為計算屬性中的函數名
computed: { toggleAll: { get() { return this.unCompleteCount === 0; }, set(stutus) { this.items.forEach(function(v) { v.completed = stutus; }); } } }
v-model 雙向綁定數據,v-model=“data”寫在html的表單標簽中,計算屬性中的函數有get和set的雙向綁定數據方法,所以可以將v-model的值作為計算屬性中的函數名
computed: { toggleAll: { get() { return this.unCompleteCount === 0; }, set(stutus) { this.items.forEach(function(v) { v.completed = stutus; }); } } }
本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。