【vue动态组件】VUE使用component :is 实现在多个组件间来回切换

VUE使用component :is 实现在多个组件间来回切换

component :is 动态父子组件传值

相关代码实现:

javascript 复制代码
 <component:is="vuecomponent"></component>


import componentA from 'xxx';
import componentB from 'xxx';
import componentC from 'xxx';

switch(item) {
 case A:
    this.vuecomponent = 'componentA';
 break;

case B:
    this.vuecomponent = 'componentB';
 break;
default:
 this.vuecomponent = 'componentC';
}

vue官方文档解释:

参考文档:组件基础 | Vue.js (vuejs.org)

相关推荐
程序员清风几秒前
快手二面:乐观锁是怎么用它来处理多线程问题的?
java·后端·面试
訾博ZiBo11 分钟前
【Vibe Coding】001-前端界面常用布局
前端
IT_陈寒14 分钟前
《Redis性能翻倍的7个冷门技巧,90%开发者都不知道!》
前端·人工智能·后端
一线大码15 分钟前
SpringBoot 优雅实现接口的多实现类方式
java·spring boot·后端
tianyuanwo16 分钟前
tar打包过滤指定目录指南
linux·tar·过滤式打包
DARLING Zero two♡19 分钟前
【Linux操作系统】简学深悟启示录:进程间通信
linux·运维·服务器
半梦半醒*19 分钟前
gitlab部署
linux·运维·centos·ssh·gitlab·jenkins
花伤情犹在20 分钟前
Java Stream 高级应用:优雅地扁平化(FlatMap)递归树形结构数据
java·stream·function·flatmap
歪歪10024 分钟前
React Native开发Android&IOS流程完整指南
android·开发语言·前端·react native·ios·前端框架
知识分享小能手26 分钟前
uni-app 入门学习教程,从入门到精通,uni-app组件 —— 知识点详解与实战案例(4)
前端·javascript·学习·微信小程序·小程序·前端框架·uni-app