js双向数据绑定
2021-05-06 17:27
YPE html>
标签:val lis listen style element doc prope meta tar
var obj={};
var txt = document.getElementById("txt");
var show_txt = document.getElementById("show-txt");
Object.defineProperty(obj,‘txt‘,{
get : function () {
return obj;
},
set : function (value) {
show_txt.innerHTML = value;
}
});
txt.addEventListener(‘keyup‘,function (e) {
obj.txt = e.target.value;
});
js双向数据绑定
标签:val lis listen style element doc prope meta tar
原文地址:https://www.cnblogs.com/blogs-zong/p/12095887.html