<input type="text" id="input_text">
<p id="p_text"></p>
<script>
let obj = {};
Object.defineProperty(obj,'propertyname',{
get:function(){
return obj
},
set: function(newVal){
document.getElementById('input_text').value = newVal;
document.getElementById('p_text').innerHTML = newVal
}
})
document.getElementById('input_text').onkeyup = function(e){
obj.propertyname = e.target.value
}
setTimeout(() => {
obj.propertyname = '程序小小黑'
},3000)
</script>