[Vuejs]-2018 equivalent of jQuery's basic sizzle selector?

4👍

Ideally, you don’t ever manipulate the DOM with VueJS. Your component data should drive the DOM, using the data to calculate which classes are on an element or which elements are visible. But I would say the Vue equivalent of your question would be refs: https://v2.vuejs.org/v2/guide/components.html#Child-Component-Refs

You can put a ref on an element and reference it in js:

<div id="parent">
  <user-profile ref="profile"></user-profile>
  <table ref="table"></table>
</div>

var parent = new Vue({ el: '#parent' })

var child = parent.$refs.profile
var table = parent.$refs.table
👤Jeff

Leave a comment