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

两个方法都可以。

相关推荐
万少4 分钟前
HarmonyOS Next 弹窗系列教程(3)
前端·harmonyos·客户端
七灵微1 小时前
【后端】单点登录
服务器·前端
持久的棒棒君5 小时前
npm安装electron下载太慢,导致报错
前端·electron·npm
渔舟唱晚@7 小时前
大模型数据流处理实战:Vue+NDJSON的Markdown安全渲染架构
vue.js·大模型·数据流
crary,记忆7 小时前
Angular微前端架构:Module Federation + ngx-build-plus (Webpack)
前端·webpack·angular·angular.js
漂流瓶jz8 小时前
让数据"流动"起来!Node.js实现流式渲染/流式传输与背后的HTTP原理
前端·javascript·node.js
SamHou08 小时前
手把手 CSS 盒子模型——从零开始的奶奶级 Web 开发教程2
前端·css·web
我不吃饼干8 小时前
从 Vue3 源码中了解你所不知道的 never
前端·typescript
开航母的李大8 小时前
【中间件】Web服务、消息队列、缓存与微服务治理:Nginx、Kafka、Redis、Nacos 详解
前端·redis·nginx·缓存·微服务·kafka
Bruk.Liu8 小时前
《Minio 分片上传实现(基于Spring Boot)》
前端·spring boot·minio