这篇体验一下VUE的双向绑定
<html> <head> <meta charset="utf-8"> </head> <body> <script src="https://unpkg.com/vue/dist/vue.min.js"></script> <div id="app"> <input type="text" v-model="CurrentTime" placeholder="当前时刻"> <h2>当前时刻{{ CurrentTime }}</h2> </div> <script> var app = new Vue({ el:'#app', data:{ CurrentTime: new Date() }, mounted:function(){ var _this = this; this.timer = setInterval(function(){ _this.CurrentTime = new Date(); },1000); }, beforeDestroy:function(){ if(this.timer){ clearInterval(this.timer); } } }); </script> </body> </html>
分享名称:Vue.js踩坑记之双向绑定-创新互联
标题URL:https://www.cdcxhl.com/article36/dehisg.html
成都网站建设公司_创新互联,为您提供软件开发、用户体验、微信公众号、云服务器、小程序开发、搜索引擎优化
声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联