Going to learn one more topic about Vue Js. It's a component load dynamically in Vue Js.
Sometimes require component load based on some criteria or condition. That time needs to load component dynamically.
The above is made possible by Vue’s element with the is special attribute:
Following are the full source code of the dynamic load component.
On the above code, we have two buttons one for Demo 1 and second for Demo 2 component.
Default Demo 1 component load and when press on Demo 2 button demo2 component load dynamically.
Click vice versa of Demo 1 and Demo 2 button and load appropriate component dynamically.
Hope you like the topic and useful to you.
Sometimes require component load based on some criteria or condition. That time needs to load component dynamically.
The above is made possible by Vue’s
In the example above, currentTabComponent can contain either:
- the name of a registered component, or
- a component’s options object
Following are the full source code of the dynamic load component.
On the above code, we have two buttons one for Demo 1 and second for Demo 2 component.
Default Demo 1 component load and when press on Demo 2 button demo2 component load dynamically.
Click vice versa of Demo 1 and Demo 2 button and load appropriate component dynamically.
Hope you like the topic and useful to you.
0 comments:
Post a Comment