标签:简单实现 UNC 实现 tar doc pre efi target htm
<!DOCTYPE html> <html> <head> <title>vue-双向数据绑定的简单实现</title> </head> <body> <input type="text" name="" id="inputText"> <span id=‘textSpan‘></span> <script type="text/javascript"> let obj = {}, inputText = document.querySelector(‘#inputText‘), textSpan = document.querySelector(‘#textSpan‘) Object.defineProperty(obj, ‘foo‘, { set: function (newValue) { inputText.value = newValue textSpan.innerHTML = newValue } }) inputText.addEventListener(‘keyup‘, function (e) { obj.foo = e.target.value }) </script> </body> </html>
标签:简单实现 UNC 实现 tar doc pre efi target htm
原文地址:https://www.cnblogs.com/maggie-pan/p/10025803.html