export default function (object, key, initialValue, cb = () => {}) {
const o = object;
let value = initialValue;
return Object.defineProperty(o, key, {
get() {
return value;
},
set(val) {
value = val;
cb();
},
});
}
export default function (object, key, initialValue, cb = () => {}) {
const o = object;
let value = initialValue;
return Object.defineProperty(o, key, {
get() {
return value;
},
set(val) {
value = val;
cb();
},
});
}
本文标题:vue 双向数据绑定
本文链接:https://www.haomeiwen.com/subject/acauohtx.html
网友评论