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;
                    });
                }
            }
        }

 

posted on 2019-10-17 17:37  宅到深夜  阅读(9518)  评论(0)    收藏  举报