vue 常规错误及解决 一

错误一: “This relative module wa not found”

根据具体报错找原因,我的是目标文件图片找不到

 

错误二: vue 打包后, "npm run build" 生成dist文件 方法二级页面展示 404, 找不到页面

解方法:

进入"src/router/index.js " 修改如下, "history" 改为 hash

 hash 访问地址有"#"

hisotry 没有"#"

  1. mode: 'history', // 去掉#,需要路由模式改为history
  2.  base: '/dist/', // 这个配置也很重要,否则会出现页面空白情况

补充:

config/index.js   修改 assetsPublicPath 为 "./"

 

详细解释:

https://blog.csdn.net/qq_33505829/article/details/99575025

https://blog.csdn.net/qq_41618510/article/details/99679916

posted @ 2020-04-19 14:55  daivid  阅读(173)  评论(0)    收藏  举报