html vue 动态加载组件
1、html:
<components :is="Comtab" ref="Comtabref">
</components>
2、引入js
<script type="text/javascript" src="../js/vue/http-vue-loader.js"></script>
3、vm
Vue.use(httpVueLoader);
// 加载表格组件
changeTabCom(item){
item.chooseType = 1;
if (+item.ruleId == 1){
this.Comtab = httpVueLoader('./ruleTabCompents/Mytab.vue');
} else if (+item.ruleId == 2){
this.Comtab = httpVueLoader('./ruleTabCompents/Pretab.vue');
}
// 调组件方法
setTimeout(()=>{
this.$refs.Comtabref.loadScene(item);
}, 1500)
}