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 });
}

两个方法都可以。

相关推荐
肖永威6 小时前
python版微电网仿真工具的前端托管选型:从http.server到FastAPI StaticFiles
前端·python·http·fastapi
风骏时光牛马6 小时前
AI插件开发与效能提效工具箱
前端
IT_陈寒6 小时前
为什么你应该学习Java?
前端·人工智能·后端
weixin_417396837 小时前
监控画面卡顿与录像缺失:码率、NVR与存储容量的排查顺序
前端·网络·技术·酒店·综合布线·弱电
曹牧7 小时前
Eclipse 工作空间(Workspace)的默认 JDK 配置
前端
其实防守也摸鱼8 小时前
Cylab在线靶场——挑战图书馆初学者指南
服务器·前端·数据库·chrome·安全·网络安全·靶场
拆房老料10 小时前
【第四部分:Agentic 智能体设计模式】16. 一个 Prompt 搞不定复杂任务?试试 Prompt Chaining
java·前端·人工智能·设计模式·prompt
曹牧15 小时前
C#:空合并运算符
java·前端·数据库
小羊没烦恼!16 小时前
铁道部新客票系统设计(二)
开发语言·前端·数据库·python·oracle·c#·php
智能直播19 小时前
RK3518:1.5G 内存 + 8G 存储,如何跑起硬件编解码、Web、AI 识别、绿幕特效
前端·人工智能·5g