Skip to content

标签页tabs关闭功能异常 #9098

@sdfsdffsdsfs

Description

@sdfsdffsdsfs
default.mp4

该bug与tabs的关闭全部、关闭其他等关闭tabs功能相关,主要场景将在附件的视频里面复现出来
具体信息:
1、使用版本:3.7.2,但是目前3.8版本经过测试仍有该问题 浏览器:chrome 141.0.7390.108(正式版本) (64 位)
2、控制台报错:
multipleTab.ts:249 TypeError: Cannot read properties of undefined (reading 'path')
at closeLeftDisabled (useTabDropdown.ts:51:32)
at ComputedRefImpl.fn (useTabDropdown.ts:88:19)
at Proxy._sfc_render (TabContent.vue:2:28)

useTabDropdown.ts:51 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'path')
at closeLeftDisabled (useTabDropdown.ts:51:32)
at ComputedRefImpl.fn (useTabDropdown.ts:88:19)

useTabDropdown.ts:51 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'path')
at closeLeftDisabled (useTabDropdown.ts:51:32)
at ComputedRefImpl.fn (useTabDropdown.ts:88:19)
at Proxy._sfc_render (TabContent.vue:2:28)

3、初步判断:在当前页使用关闭xxx功能之后,handleContextMenu 应该已经设置了 state.current

  • 但由于 JavaScript 的异步特性,state.current 的更新可能还未完成
  • getDropMenuList 就开始执行并尝试访问 state.current.path
  • 此时 state.current 可能还是 null,导致访问 .path 出错
    4、当前解决方案:添加空值访问检查
    src/layouts/default/tabs/useTabDropdown.ts
    closeLeftDisabled 函数
    // 修复前
    return validTabList[0].path === state.current?.path;
// 修复后
return [validTabList.length](https://validtablist.length/) > 0 && [state.current](https://state.current/) && validTabList[0].path === [state.current](https://state.current/).
 path;

我非常期待您和团队能够尽快解决这些问题,以提升 JEECG Boot Vue3 的稳定性和用户体验。
感谢您和团队一直以来的努力和付出!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions