html部分
通常写法:
通过<physical-result></physical-result>显示在页面上
动态引入写法:<component :is="currentView"></component>
script部分
先导入组件
import PhysicalResult from '../views/Setting/PhysicalResult.vue'
components:{
'physical':PhysicalResult
},
data中定义一个数组
componentList:['physical']
computed中
currentView(){
return this.componentList[0]
}
来源:https://dongfangyou.blog.csdn.net/article/details/105842267?spm=1001.2101.3001.6661.1&utm_medium=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.highlightwordscore&depth_1-utm_source=distribute.pc_relevant_t0.none-task-blog-2%7Edefault%7ECTRLIST%7Edefault-1.highlightwordscore