:is dynamic componentUse v-bind:is="component name" to automatically find a matching component name. If there is no matching component name, it will not be displayed. <div id="app"> <test v-bind:is="which_to_show"></test> </div> <script> var demo = new Vue({ el: "#app", data: { which_to_show: "first" }, components: first: { template: "<div>Here is the subcomponent first</div>" }, second: { template: "<div>Here is the subcomponent second</div>" }, third: { template: "<div>Here is the subcomponent third</div>" } } }); </script> By changing the value of which_to_show, you can dynamically change the component you want to load and render, as follows: This is the end of this article about the detailed explanation of vue.js dynamic components. For more relevant vue.js dynamic component content, please search for previous articles on 123WORDPRESS.COM or continue to browse the following related articles. I hope everyone will support 123WORDPRESS.COM in the future! You may also be interested in:
|
<<: Detailed explanation of MySQL foreign key constraints
>>: Detailed tutorial on building a private Git server on Linux
1. Video tag Supports automatic playback in Firef...
Table of contents 1. Sample code 2. See the essen...
0x00 Introduction WordPress is the most popular C...
introduce HTML provides the contextual structure ...
Table of contents Docker deployment Always on clu...
Table of contents 1. Basic use 2. Several points ...
A situation that often occurs in a project is tha...
Preface When creating a primary and foreign key f...
This article shares the specific code of typescri...
Table of contents Why do we need partitions? Part...
1. MySQL rpm package installation # Download the ...
Things to note 1. First, you need to create a my....
This article shares the specific code of JavaScri...
Table of contents Summarize <template> <...
Mobile browsers place web pages in a virtual "...