bhuh12 / vue-router-tab

Vue.js tab components, based on Vue Router.

Home Page:https://bhuh12.github.io/vue-router-tab/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

beforePageLeave cannot use 没反应

tarzanking opened this issue · comments

Bug 描述

点击退出,refresh,关闭 完全没有反应

问题重现

重现行为的步骤:

  1. 点击退出,refresh,关闭 完全没有反应

预期行为

显示alert提醒 或者任何 的 console.log

截图

image

关键代码

  export default {
    beforePageLeave(tab, type) {
    console.log(type)
  }

开发环境(请填写以下信息)

  • Node.js: v10.4.0
  • Vue: 2.6.12
  • Vue Router: 3.5.1
  • Vue Router Tab: "1.2.5"

运行环境(请填写以下信息)

  • 设备: PC
  • 操作系统: window 10
  • 浏览器和版本: Chrome

附加内容

在此添加有关此问题的任何其他内容。

beforePageLeave 需要在页签所在的页面组件中定义,即 routertab 路由的直接子组件。

Hi I have tested the beforePageLeave function it only work on the following path....
我也已经在页签的页面component 中 define 了
image

大概发现问题了。
页面离开确认的功能是从缓存的组件中获取配置的方法的,功能开发较早。后续基于 keepAlive 重构支持了页签不缓存。但离开确认的场景会有漏洞,不支持未缓存的页签。
这个我会安排时间修复下,你可以先设置页面可缓存看是否起作用。

嗯 可缓存页面 起了作用
感谢您开发此 vue router tab 真的非常好用

v1.2.6 已经修复该问题

该版本为 Vetur 扩展提供了组件语法提示,欢迎更新体验

image

更新日志:https://bhuh12.gitee.io/vue-router-tab/zh/guide/changelog.html