: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
When receiving this requirement, Baidu found many...
1. Create a repository in the specified directory...
Preface This article mainly introduces the releva...
There are many ways to generate a global ID. Here...
When designing table structures, numeric types ar...
During normal project development, if the MySQL v...
Count(*) or Count(1) or Count([column]) are perha...
nginx (engine x) is a high-performance HTTP and r...
<br />Hello everyone! It’s my honor to chat ...
This article shares the specific code for JavaScr...
Table of contents Install Docker-ce for the devel...
We usually use routing in vue projects, and vue-r...
Set the width of the body to the width of the wind...
Quickly install the tensorflow environment in Doc...
Preface We may have heard of the concept of rowid...