vue中列表页面跳转打开新页面,关闭新页面并刷新列表页面

文章讲述了在Vue应用中,如何从列表页面跳转到新页面,并在新页面关闭时刷新列表页面的方法。通过设置window.onunload事件监听页面关闭,以及使用this.childWindow对象来管理新打开的页面,实现页面间的交互和刷新功能。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

vue中列表页面跳转打开新页面,关闭新页面并刷新列表页面

一、列表页面

 mounted() {
        // 监听当前页面的关闭事件
        window.onunload = () => {
            if (this.childWindow && !this.childWindow.closed) {
                this.childWindow.close()
            }
        }
    },

//跳转
handleAdd() {
      let routeUrl = this.$router.resolve({
          path: '/home/projectContractInput',
          query: { type: 'add' },
      })
      this.childWindow = window.open(routeUrl.href, '_blank')
      this.childWindow.onunload = () => {
          if (this.childWindow && this.childWindow.closed) {
              this.getList()
          }
      }
  },

二、新页面

 window.close()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值