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 小时前
我的软件冲进苹果商店下载榜前 50 了
前端
阳光是sunny1 小时前
别再被 worktree 绕晕了!AI 编程时代你必须掌握的 Git 隔离神器
前端·人工智能·后端
万少3 小时前
万少的博客 - 技术分享与解决方案
前端·javascript·后端
尘世中一位迷途小书童5 小时前
用 Cesium 撸了一个森林火情监控大屏,弧线、粒子、发光效果都齐了
前端·javascript
IT_陈寒6 小时前
垃圾回收器选错了,我的Java服务内存炸了
前端·人工智能·后端
月光下的丝瓜6 小时前
Flutter 国内安装指南
前端·flutter
先吃饱再说6 小时前
JavaScript中`this` 的“千层套路”:从默认绑定到箭头函数的五种指向
javascript
玄星啊6 小时前
AI 编程的第 30 天,我怀念古法 Coding 了
前端·ai编程
Jolyne_6 小时前
Angular基础速通
前端·angular.js
foxire7 小时前
基于nodejs实现服务端内核引擎
javascript