针对vue项目打包以后,除了首页意外,其余页面是空白的,需要在服务端进行配置。

原因是router中,mode是history引起的

如果是nginx,改成如下:

location / {
            root /workspace/shop/client/dist;
            try_files $uri $uri/ /index.html;
           # error_page 404 /index.html;
        }

  

参考链接:https://router.vuejs.org/zh/guide/essentials/history-mode.html#%E5%90%8E%E7%AB%AF%E9%85%8D%E7%BD%AE%E4%BE%8B%E5%AD%90

相关文章:

  • 2021-12-21
  • 2021-10-15
  • 2021-07-18
  • 2021-06-14
  • 2021-08-02
  • 2022-12-23
  • 2022-12-23
  • 2021-12-02
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2021-08-27
  • 2022-12-23
  • 2021-06-29
  • 2022-12-23
相关资源
相似解决方案