Vue JS Instance properties

Given an instance of Vue, stored into a variable const vm = new Vue(/*...*/), you can inspect and interact with it.

Properties of a Vue instance

vm.$datathe data object associated to the instance
vm.$propsthe props the instance has received
vm.$elthe DOM element to which the instance is bound
vm.$optionsthe object used to instantiate the Vue instance
vm.$parentthe parent instance
vm.$rootthe root instance (if this is the root instance, this points to itself)
vm.$childrenan array of children instances
vm.$slotsan array of the associated slots contained in the template
vm.$scopedSlotsan array of the associated scoped slots
vm.$refsan object that contains a property for each element pointed by a ref attribute defined in the template
vm.$isServertrue if the Vue instance is running on the server (useful in server-side rendering)
vm.$attrsan object of attributes that are provided to the component but not defined as props
vm.$listeners an object of v-on event listeners assigned to the component

Leave a Reply

Your email address will not be published. Required fields are marked *