<td contenteditable="true" @input="inputEvent()"></td>
You need to pass in the td
dom element in inputEvent()
;
淡淡烟草味2017-05-19 10:13:27
<body>
<p id="app">
<button @click='add'>按钮</button>
</p>
</body>
new Vue({
el: "#app",
methods: {
add(e) {
console.log(e.target)
}
}
})
Is this what you mean? ?
伊谢尔伦2017-05-19 10:13:27
If there are no parameters, just set an event in the receiving method
function (event) {}
If there are other parameters, use inputEvent($event,other)
给我你的怀抱2017-05-19 10:13:27
// 传一个event
@input="inputEvent($event)"
inputEvent(e) {
console.log(e.path[0]. outerHTML)
}