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

保存新增 后报错

li-guojiang opened this issue · comments

一个新增编辑页面,有个 “保存新增” 按钮, 现在新增完成或编辑完成后 跳转到新增页面
if (this.isContinue) {
this.$tabs.close({
to: {
name: "PurchaseItem",
query: {},
},
refresh: true,
});
} else {
this.$tabs.close();
}
这样实现会报错:
vue-router-tab.umd.min.js?c1ce:1 Uncaught TypeError: Cannot read property 'offsetLeft' of null
at VueComponent.isInView (vue-router-tab.umd.min.js?c1ce:1)
at VueComponent.adjust (vue-router-tab.umd.min.js?c1ce:1)
at eval (vue-router-tab.umd.min.js?c1ce:1)

可以展开定位到具体的错误代码看看吗?

可以展开定位到具体的错误代码看看吗?
应用场景为:关闭当前路由后打开相同路由,比如,当前路由为{name: "PurchaseItem"}
运行
this.$tabs.close({
to: {
name: "PurchaseItem",
},
refresh: true,
});
就会报错:
vue-router-tab.umd.min.js?c1ce:1 Uncaught TypeError: Cannot read property 'offsetLeft' of null
at VueComponent.isInView (vue-router-tab.umd.min.js?c1ce:1)
at VueComponent.adjust (vue-router-tab.umd.min.js?c1ce:1)
at eval (vue-router-tab.umd.min.js?c1ce:1)

是相同路由的不同参数页签吗?
如果完全相同路由可以直接用 refresh

新增和编辑用的同一个路由,根据是否传Id这个参数判断是新增还是修改(新增不传参数,修改传参数Id)
页面上有个按钮"保存后新增",如果是编辑状态下点击这个按钮,用refresh不能实现这个功能~~

能提供下这个路由配置吗?
新增和编辑是否共用页签

新增和编辑是共用页签的,编辑的时候提供query:{ Id:xxx},新增时没有参数
{
path: '/purchaseitem',
name: "PurchaseItem",
meta: {
title: '物资采购',
auth: 'Purchase',
key: 'fullPath'
},
component: () => import('@/views/purchase/Item')
}

更新 v1.2.2 版本看看是否解决问题

可以了 ,感谢!(^_^)

不客气