vue

https://www.w3cplus.com/vue/vue-two-way-binding-object-defineproperty.html

 

var a = {};
Object.defineProperty(a, 'b', { set: function(newValue) { console.log('你要赋值给我,我的新值是:'+ newValue); }, get: function() { console.log("你取我的值"); return 2;
}
});

posted on 2019-04-15 11:42  szllq2000  阅读(90)  评论(0编辑  收藏  举报