Skip to content

vue/no-dollar-el ​

disallow using $el

  • ❗ This rule has not been released yet.

📖 Rule Details ​

This rule reports uses of the $el component instance property, both on the current instance ($el, this.$el, const { $el } = this) and on other instances (this.$refs.modal.$el).

$el only points to the root DOM element while the component has a single root element. Once a component renders multiple root nodes, $el points to a placeholder text node instead, so code like $el.querySelector(...) silently breaks. Use template refs to access DOM elements instead.

Now loading...
Now loading...

🔧 Options ​

Nothing.

📚 Further Reading ​

🔍 Implementation ​