(干货)vue 事件参数$event
<!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><title>事件简写和事件对象$event</title><script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></scrip
·
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>事件简写和事件对象$event</title>
<script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
<script>
window.onload = function () {
let vm = new Vue({
el: '#app',
methods: {
show() {
console.log(111);
},
print(e) {
var tatget = e.target;
// console.log(e);
console.log(tatget.innerHTML); //DOM对象
// console.log(this);
}
}
});
}
</script>
</head>
<body>
<div id="app">
<button v-on:click="show">点我</button>
<button @click="show">点我</button>
<hr>
<button @click="print($event)">Click Me</button>
</div>
</body>
</html>
更多推荐
已为社区贡献1条内容
所有评论(0)