0👍
✅
You can add $ref
to the container element like this: <div ref="container-ref">
.
Then to access the container element in vue methods, just do this.$refs["container-ref"]
.
Explanation:
You can add ref
attribute to any tag, even child components. It is parsed by vue only, browser ignores it.
If the ref is attached to a HTML tag, this.$refs[key]
will return the corresponding DOM element.
If the ref is attached to a child component, this.$refs[key]
will return the corresponding vue instance.
Source:stackexchange.com