【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的原理还是有用的,哈哈哈。

相关推荐
深念Y1 小时前
夸克网盘 应用程序无法启动,因为应用程序的并行配置不正确。有关详细信息,请参阅应用程序事件日志,或使用命令行sxstrace.exe 工具。
windows·bug·报错·系统·更新·网盘·夸克
万粉变现经纪人4 小时前
如何解决 pip install mysqlclient 报错 ‘mysql_config’ not found 问题
数据库·python·mysql·pycharm·bug·pandas·pip
f***24114 小时前
Bug悬案:技术侦探的破案指南
算法·bug
前端大波6 小时前
avue-crud 操作列透明 bug
bug
hui函数1 天前
Python系列Bug修复|如何解决 pip install 安装报错 invalid command ‘bdist_wheel’(缺少 wheel)问题
python·bug·pip
hui函数1 天前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有索引未设为 trusted-host 导致拒绝 问题
python·bug·pip
hui函数1 天前
Python系列Bug修复|如何解决 pip install 安装报错 Backend ‘setuptools.build_meta’ 不可用 问题
python·bug·pip
hui函数1 天前
Python系列Bug修复|如何解决 pip install -r requirements.txt 私有仓库认证失败 401 Unauthorized 问题
python·bug·pip
hui函数1 天前
Python系列Bug修复|如何解决 pip install -r requirements.txt 子目录可编辑安装缺少 pyproject.toml 问题
python·bug·pip
啊湘2 天前
VSCODE英文界面切换为中文(适用CURSOR等使用)
ide·vscode·编辑器·bug·cursor