|
|
|
@ -8,14 +8,23 @@ |
|
|
|
|
<body> |
|
|
|
|
<div id="root"> |
|
|
|
|
<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> |
|
|
|
|
|
|
|
|
|
<script type="text/javascript"> |
|
|
|
|
Vue.config.productionTip = false |
|
|
|
|
new Vue({ |
|
|
|
|
el: '#root', |
|
|
|
|
data: { |
|
|
|
|
name: "haha!" |
|
|
|
|
}, |
|
|
|
|
methods:{ |
|
|
|
|
showInfo(e) { |
|
|
|
|
console.log(e.key, e.keyCode) |
|
|
|
|
console.log(e.target.value) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
</script> |
|
|
|
|