- 需要子组件得地方添加:
<component :is="currentCom"></component>
- 引入子组件:
import MaterialVoice from '@/components/Account/Material/MaterialVoice/index.vue'
- data里面声明初始化值currentCom
- 执行自己的方法赋值 MaterialVoice 给 currentCom
methods: {
condiation () {
// ....some code
this.currentCom = MaterialVoice
}
}
currentCom就是你引入的组件
转载于:https://www.cnblogs.com/Mr-Rshare/p/11065579.html