【bug日志-水】解决本地开发下代理和url同名导致刷新404的问题

bug描述

在本地开发,并且路由是history的模式下,代理和url同名的情况下,刷新会404。

javascript 复制代码
  {
    path: '/googleAds',//如果有个代理也叫googleAds,刷新时就会404
    name: 'googleAds',
    icon: 'sound',
    routes: [
      {
        path: '/googleAds/GoogleAdsSettingPage', 
        name: 'GoogleAdsSettingPage',
        component: '@/pages/GoogleAds/GoogleAdsSettingPage',
      },
    ],
  },

解决方案

因为history模式下,浏览器会以前端路由的url去发送请求,这当然是请求不到的,所以是404。

解决办法有:

1、用hash模式,这样就不会用前端路由的那一段去服务器请求了。

2、代理或者url路径改名,不要同名就行

END

看来明白hash和history的原理还是有用的,哈哈哈。

相关推荐
Direction_Wind8 小时前
Flinksql bug: Heartbeat of TaskManager with id container_XXX timed out.
大数据·flink·bug
AIBigModel3 天前
智能情趣设备、爆 bug:可被远程操控。。。
网络·安全·bug
Direction_Wind3 天前
flinksql bug: Received resultset tuples, but no field str
bug
远瞻。3 天前
【bug】diff-gaussian-rasterization Windows下编译 bug 解决
windows·bug
中草药z3 天前
【测试】Bug+设计测试用例
功能测试·测试工具·测试用例·bug·压力测试·测试
我又来搬代码了4 天前
【Android】【bug】Json解析错误Expected BEGIN_OBJECT but was STRING...
android·json·bug
葵野寺4 天前
【软件测试】BUG篇 — 详解
bug·测试
青青子衿越6 天前
微信小程序右上角分享页面找不到路径bug
微信小程序·小程序·bug
刘火锅7 天前
Bug 记录:SecureRandom.getInstanceStrong()导致验证码获取阻塞
spring boot·spring·spring cloud·bug
一起去改变世界7 天前
卸载或重装软件提示缺少msi的解决方法(软件卸载功能修复)
windows·bug·美女