vue 获取 键盘值 keyCode 写法
原文链接:http://www.jb51.net/article/111485.htm<!DOCTYPE html><html><head> <meta charset="utf-8"> <title></title&am
·
原文链接:http://www.jb51.net/article/111485.htm
<!DOCTYPE html>
<html>
<head>
<meta charset=
"utf-8"
>
<title></title>
<script src=
"../js/Vue.js"
charset=
"utf-8"
></script>
<script type=
"text/javascript"
>
window.onload =
function
() {
var
vm =
new
Vue({
el:
'#box'
,
data: {},
methods: {
show:
function
(ev) {
alert(ev.keyCode)
}
}
});
}
</script>
</head>
<body>
<div id=
"box"
>
<input type=
"text"
@keydown=
"show($event)"
>
</div>
</body>
</html>
更多推荐
已为社区贡献28条内容
所有评论(0)