vue v-on v-text 的运用
作者:互联网
<!DOCTYPE html> <html> <meta charset="utf-8"> <head> <title></title> </head> <script src="./vue.js" type="text/javascript" charset="utf-8"></script> <body> <div id="app"> <button type="" @click='show'>浪起来</button> <button type="" @click='hide'>低调</button> <div v-text='msg'></div> </div> <script type="text/javascript"> var vm = new Vue({ el:'#app', data:{ 'msg':'abckdefhigklmnopqrstuvwxyz', 'intervalid':null }, methods:{ show:function(){ if(this.intervalid == null){ this.intervalid=setInterval(() => { var start = this.msg.substring(0,1) var end = this.msg.substring(1) this.msg=end + start },300) } }, hide:function(){ clearInterval(this.intervalid) this.intervalid=null } } }) </script> </body> </html>
标签:vue,end,text,intervalid,substring,var,msg,运用,null 来源: https://www.cnblogs.com/chengfengchi/p/11337137.html