脚本宝典收集整理的这篇文章主要介绍了Vue异步组件Demo,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
在大型应用中,我们可能需要将应用拆分为多个小模块,按需从服务器下载。为了进一步简化,Vue.js 允许将组件定义为一个工厂函数,异步地解析组件的定义。Vue.js 只在组件需要渲染时触发工厂函数,并且把结果缓存起来,用于后面的再次渲染。
下面是我写的一个简单Vue异步组件Demo。