<!DOCTYPE html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js"></script>
</head>
<style type="text/css">
button{
font-size: 20px;
}
</style>
<body>
<div id="app">
<!-- <input type="text" v-on:keyup.enter="keyup"></input> -->
<input type="text" v-on:keyup.enter.space.esc="keyup"></input>
<br/>
<input type="text" v-on:keyup.shift="shift"></input>
<br/>
<input type="text" v-on:keyup.meta="shift"></input>
</div>
<!--
按键修饰符
v-on:keyup.enter.space.esc 链式调用
v-on:keyup.shift="shift" 系统修饰符
v-on:keyup.meta 系统修饰符 windows
-->
</body>
<script type="text/javascript">
new Vue({
el : "#app",
methods : {
/*keyup : function (e) {
if(e.which == 13){
alert('you pressed enter');
}
}*/
keyup : function () {
alert('you pressed enter');
},
shift : function () {
// body...
alert('shift');
}
}
})
</script>
</html>
<html>
<head>
<title></title>
<meta charset="UTF-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.1.8/vue.min.js"></script>
</head>
<style type="text/css">
button{
font-size: 20px;
}
</style>
<body>
<div id="app">
<!-- <input type="text" v-on:keyup.enter="keyup"></input> -->
<input type="text" v-on:keyup.enter.space.esc="keyup"></input>
<br/>
<input type="text" v-on:keyup.shift="shift"></input>
<br/>
<input type="text" v-on:keyup.meta="shift"></input>
</div>
<!--
按键修饰符
v-on:keyup.enter.space.esc 链式调用
v-on:keyup.shift="shift" 系统修饰符
v-on:keyup.meta 系统修饰符 windows
-->
</body>
<script type="text/javascript">
new Vue({
el : "#app",
methods : {
/*keyup : function (e) {
if(e.which == 13){
alert('you pressed enter');
}
}*/
keyup : function () {
alert('you pressed enter');
},
shift : function () {
// body...
alert('shift');
}
}
})
</script>
</html>