Built‐In Attributes - sana028/VueLearningsPoc GitHub Wiki
Built-In Attributes : In Vue.js we have three built in attributes which are used to refer objects and components. They are 1. is Attribute 2. key attribute 3. ref attribute
'is' attribute used with built in component <component> the below are two ways we majorly use 'is'
1.using the is we can create a dynamic component, where the is attribute defines which component should be active based on user condition.
ex: `<component :is="active-comp"/>`
2.replace a native element(component) with vue compoent .
ex:`<component is="vue:component-name"/>`
'key' attribute , we mostly use it with v-for, where key uniquely identifies each element created from v-for and it render the elements in a order
with out repetition. but we don't use key the elements all are mixed up and the result will be have only one value from array or objects.
'ref' attribute , ref is used to get the reference of a element or a child component.
for example :` <p ref="el"> hello world</p>`
In above example the using this.$ref object we can get the p Dom data and we can modify it dynamically.
**`this.$ref.el="welcome" `**