Computed属性用法

new Vue({
    el: '.app',
    data: {
        foo: 'test',
    },
    computed: {
        _foo: {
            set: function(value) {
                this.foo = value;
            },
            get: function() {
                return this.foo
            }
        }
    }
})

以上DEMO 双向绑定 可以在set 于 get中增加复杂逻辑
posted @ 2017-02-23 10:13  清新剂  阅读(425)  评论(0编辑  收藏  举报