事件修饰符,方法只需要纯粹的数据逻辑,而不是处理dom事件的细节
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<title></title>
<style>
div {
width: 100px;
height: 100px;
background: green;
}
</style>
</head>
<body>
<div id="app">
<div @click="click1">
<div @click="click2">
<div @click="click3"></div>
</div>
</div>
</div>
</body>
<script type="text/javascript">
new Vue({
el: '#app',
data: {
message: 'hello vue.js.'
},
watch: {
},
computed: {
},
created() {
// this.getBox()
},
mounted() {},
methods: {
click1() {
console.log(1);
},
click2() {
console.log(2);
},
click3() {
console.log(3);
}
},
});
</script>
</html>

.prevent,阻止默认行为.native,监听根元素的事件.stop,阻止事件冒泡.self,只能在自己身上触发.capture,捕获机制.once,只执行一次
按键修饰符
.enter,enter键.up,up键