当前位置: 首页 > Web前端 > vue.js

Vue项目优化

时间:2023-03-31 16:16:32 vue.js

1.组件按需加载component:()=>import('@/components/login')2.大数据处理vxe-table(全功能):https://xuliangzhan_admin.git...3.当使用keep-alive包裹动态组件时,不活跃的组件实例将被缓存而不是被销毁。4.图片懒加载安装地址:https://www.npmjs.com/package...main.jsimportvuefrom'vue'importAppfrom'./App.vue'从'vue-lazyload'Vue.use(VueLazyload)//或使用optionsVue.use(VueLazyload,{preLoad:1.3,error:'dist/error.png',loading:'dist/loading.gif',attempt:1})newVue({el:'body',components:{App}})template

5.清除timer组件,不用的时候写入setTimeout和setInterval中。清除方法请参考:http://www.techshare100.com/a...六、vue3.x打包优化请看这里:http://www.fenxianglu.cn/arti...处写作结束,欢迎关注作者:http://www.fenxianglu.cn/