<!DOCTYPE html>标签:vue,background,color,tip,js,padding,Vue,5px,030 From: https://blog.51cto.com/u_15356972/6085187
<html lang="en">
<head>
<meta charset="UTF-8">
<title>事件绑定</title>
<script type="text/javascript" src="../js/vue.js"></script>
<style>
.box1{
padding: 5px;
background-color: skyblue;
}
.box2{
padding: 5px;
background-color: orange;
}
</style>
</head>
<body>
<div id="root">
<h2>{{name}}</h2>
<div class="box1" @click="showMsg($event,1)">
box1
<div class="box2" @click="showMsg($event,2)">
box2
</div>
</div>
</div>
<script type="text/javascript">
Vue.config.productionTip = false;
const vm = new Vue({
el:'#root',
data:{
name:'虾米大王'
},
methods:{
showMsg(event,tip){
console.log(tip); //正常,冒泡事件时处理顺序
}
}
})
</script>
</body>
</html>