How to get DOM element of current Vue component?
When I’m inside some method in vue commponent and want to use some dom manipulation (by jquery) I need to get DOM element coresponnding to my component (especially in case when I have many instances of my component on page – I need to ‘work’ separately on each of them – so I cannot detect DOM element using only jquery selector without tricks…)
Just by this (in any method in “methods”):
let domElement = this.$el;
But remember this is valid as long as your component is not a Fragment Instance i.e. it has a single root HTML tag
The answers/resolutions are collected from stackoverflow, are licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0 .