vue 异步组件 远程组件
1.异步组件new Vue({// ...components: {'my-component': () => import('./my-async-component')}})2.远程组件new Vue({// ...components: {'my-component': () => import('htt...
·
1.异步组件
new Vue({
// ...
components: {
'my-component': () => import('./my-async-component')
}
})
2.远程组件
new Vue({
// ...
components: {
'my-component': () => import('https:...xxxx.vue')
}
})
3.动态执行远程组件
async mounted() {
if (!this.url) return;
if (!window.Cache)
window.Cache = {};
if (!window.Cache[this.url])
window.Cache[this.url] = Axios.get(this.url);
let res = await window.Cache[this.url];
this.mode = new Function(`return ${res.data}`)();
console.log(this.mode);
}

更多推荐



所有评论(0)