: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
Zero: Uninstall old version Older versions of Doc...
1. Why set maxPostSize? The tomcat container has ...
Cerebro is an evolution of the Elasticsearch Kopf...
The event scheduler in MySQL, EVENT, is also call...
1. Take nginx as an example Nginx installed using...
Introduction to Linux alarm function Above code: ...
It’s great to use CSS to realize various graphics...
After going through a lot of hardships, I searched...
Table of contents 1. What is a template string? 2...
This article mainly introduces the sample code of...
Flexible layout (Flexbox) is becoming increasingl...
background Not long ago, I made a function about ...
Preface In front-end development, we often encoun...
Preface When a Linux is fully set up, you can use...
When installing mha4mysql, the steps are roughly:...