: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
Four practical vue custom instructions 1. v-drag ...
Table of contents Character Set Comparison Rules ...
Solution to 1449 and 1045 exceptions when connect...
Today I accidentally saw the parameter slave_exec...
Installation suggestion : Try not to use .exe for...
This article shares the specific code for WeChat ...
Table of contents 1. Index Basics 1. Types of Ind...
This article discusses several major zero-copy te...
Table of contents 1. Trigger Introduction 1. What...
Preface I watched web.dev's 2020 three-day li...
Table of contents 1. Scenario description: 2. Cas...
Mysql limit paging statement usage Compared with ...
Table of contents 1. Quick understanding of conce...
This article example shares the specific code of ...
I have previously introduced to you the configura...