标签:src sse 键盘 core bubuko scale name vue.js lan
vue -on事件可以侦探键盘,这里放到vue不放es
1 <!DOCTYPE html> 2 <html lang="en"> 3 <head> 4 <meta charset="UTF-8"> 5 <meta name="viewport" content="width=device-width, initial-scale=1.0"> 6 <meta http-equiv="X-UA-Compatible" content="ie=edge"> 7 <title>v-on</title> 8 <script type="text/javascript" src="../assets/js/vue.js"></script> 9 </head> 10 <body> 11 <h1>v-on实例</h1> 12 <hr> 13 <div id="app"> 14 本场得分:{{score}} <span v-text="score"></span><div v-text="score"></div> 15 <p><button v-on:click="add">加分</button></p> 16 <p><button @click="sub">减分</button></p> 17 <input type="text" v-on:keyup.13="onEnter" v-model="score2"> 18 <div v-on:mouseover="change">{{omo}}</div> 19 </div> 20 <script type="text/javascript"> 21 var app = new Vue({ 22 el:‘#app‘, 23 data:{ 24 score:2, 25 score2:1, 26 omo:‘666666‘ 27 }, 28 methods:{ 29 add:function(){ 30 this.score=this.score*parseInt(this.score2) 31 }, 32 sub:function(){ 33 this.score-- 34 }, 35 onEnter:function(){ 36 this.score=this.score+parseInt(this.score2) 37 }, 38 change:function(){ 39 this.omo=‘11111‘ 40 } 41 42 } 43 }) 44 45 46 </script> 47 </body> 48 </html>
标签:src sse 键盘 core bubuko scale name vue.js lan
原文地址:https://www.cnblogs.com/wilsunson/p/9438563.html