RuoYi-Vue 全新 Pro 版本:清除url地址栏路由参数

问题:当前页面保存数据后,要清空当前地址栏的参数。

页面A开始跳转到B

复制代码
//页面A跳转
  this.$router.push({
        path: "你的path",
        query: {
          id: id,
        },
      });

页面B开始接收数据

复制代码
//页面B,在你需要的地方进行接收
this.$route.query.id
当点击保存后,开始清空url
复制代码
//简写
  this.$router.replace({ query: {} });

const query = { ...this.$route.query };

if (query.id) {
      delete query.id;
   //$router.replace() 方法更新路由,但不改变浏览历史
      this.$router.replace({ query });
}

两个方法都可以。

相关推荐
名字还没想好☜1 天前
React createPortal 实战:模态框逃出 overflow:hidden、事件冒泡与焦点管理
前端·javascript·react.js·ecmascript·react·createportal
用户059540174461 天前
Playwright测试AI记忆存储踩坑实录:这个时序问题让我排查了6小时
前端·css
IT_陈寒1 天前
Redis踩了个大坑,原来DEL命令也会卡住整个实例
前端·人工智能·后端
一个水瓶座程序猿.1 天前
基于Spring AI RAG 的AI知识库前端交互实现
前端·人工智能·spring
breeze jiang1 天前
React + TypeScript 编辑表单:为什么要区分 name 和 editingName
前端·typescript
米码收割机1 天前
【移动】线上购物移动端网站(源码+文档)【独一无二】
java·开发语言·前端·python·django
To_OC1 天前
对接大模型流式接口,我被一个 ReadableStream 卡了半小时
前端·node.js·llm
fthux1 天前
RenoPit 能为普通业主做什么?看懂图纸、审查合同,提前发现装修坑
javascript·人工智能·ai·开源·github·chrome扩展·open source·edge扩展·firefox扩展
仿生狮子1 天前
✂️ Nuxt 最简单的字体裁剪工具:Fontize
javascript·vue.js·nuxt.js
石小石Orz1 天前
我发现了开发者AI产品营收的新方向
前端·虚拟现实