Monday, May 20, 2024
 Popular · Latest · Hot · Upcoming
83
rated 0 times [  88] [ 5]  / answers: 1 / hits: 168007  / 10 Years ago, thu, november 13, 2014, 12:00:00

How can I find the vue.js component corresponding to a DOM element?


If I have


element = document.getElementById(id);

Is there a vue method equivalent to the jQuery


$(element)

More From » node.js

 Answers
12

The proper way to do with would be to use the v-el directive to give it a reference. Then you can do this.$$[reference].



Update for vue 2



In Vue 2 refs are used for both elements and components: http://vuejs.org/guide/migration.html#v-el-and-v-ref-replaced


[#68813] Tuesday, November 11, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
beatriceisabelad

Total Points: 710
Total Questions: 107
Total Answers: 99

Location: Cayman Islands
Member since Sat, Sep 17, 2022
2 Years ago
;