javascript - How to pass the dom bound to the current instruction in the vue instruction
过去多啦不再A梦
过去多啦不再A梦 2017-05-19 10:11:27
0
5
448
<td contenteditable="true" @input="inputEvent()"></td>

You need to pass in the td dom element in inputEvent();

过去多啦不再A梦
过去多啦不再A梦

reply all(5)
Ty80

https://vuejs.org/v2/guide/ev...

小葫芦

Why do we need to pass it? Isn’t it in the event object?

淡淡烟草味
<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? ?

伊谢尔伦

If there are no parameters, just set an event in the receiving method
function (event) {}
If there are other parameters, use inputEvent($event,other)

给我你的怀抱
// 传一个event
@input="inputEvent($event)" 

inputEvent(e) {
console.log(e.path[0]. outerHTML)
}
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!