|
|
@ -8,14 +8,23 @@ |
|
|
|
<body> |
|
|
|
<body> |
|
|
|
<div id="root"> |
|
|
|
<div id="root"> |
|
|
|
<h1>你好 {{name}}</h1> |
|
|
|
<h1>你好 {{name}}</h1> |
|
|
|
<input type="text" placeholder="你动我试试"> |
|
|
|
<input type="text" placeholder="你动我试试" @keyup.space="showInfo"><br> |
|
|
|
|
|
|
|
<input type="text" placeholder="你动我试试" @keyup.caps-lock="showInfo"><br> |
|
|
|
|
|
|
|
<input type="text" placeholder="你动我试试" @keydown.tap="showInfo"><br> |
|
|
|
</div> |
|
|
|
</div> |
|
|
|
|
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
<script type="text/javascript"> |
|
|
|
|
|
|
|
Vue.config.productionTip = false |
|
|
|
new Vue({ |
|
|
|
new Vue({ |
|
|
|
el: '#root', |
|
|
|
el: '#root', |
|
|
|
data: { |
|
|
|
data: { |
|
|
|
name: "haha!" |
|
|
|
name: "haha!" |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
methods:{ |
|
|
|
|
|
|
|
showInfo(e) { |
|
|
|
|
|
|
|
console.log(e.key, e.keyCode) |
|
|
|
|
|
|
|
console.log(e.target.value) |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
}) |
|
|
|
}) |
|
|
|
</script> |
|
|
|
</script> |
|
|
|