Vue全家桶解析时间太长

clipboard.png

TIPS: 请求为本地, 网络很快, 主要是JS 代码解析阻塞导致白屏时间过久

如图所示, javascript 在手机浏览器中加载速度过慢, 加上网络请求等平常会达到2s左右的时间才能展示首页, 请问各位大佬有什么解决方案吗

以尝试以下方案
  1. 按需加载router
  2. 第三方库打入一个包
  3. 基本代码优化
想用但是条件不予许
  1. SSR
阅读 3.5k
1 个回答
// router.js
import Vue from 'vue'
import Router from 'vue-router'
Vue.use(Router)
export function createRouter () {
  return new Router({
    mode: 'history',
    routes: [
      { path: '/', component: () => import('./components/Home.vue') },
      { path: '/item/:id', component: () => import('./components/Item.vue') }
    ]
  })
}
推荐问题