如何解決npm run build後頁面空白?

歡迎關注前端小謳的github,閱讀更多原創技術文章
問題一:assetsPublicPath配置錯誤

解決辦法:打開config/index.js文件前端

build:{
    // assetsPublicPath: '/'
    assetsPublicPath: './'
}

clipboard.png

問題二:路由history模式配置有誤

解決辦法:關閉路由historym模式git

export default new Router({
  // mode: 'history', // require service support
  scrollBehavior: () => ({
    y: 0
  }),
  routes: constantRouterMap
})

clipboard.png

相關文章
相關標籤/搜索