VTable icon indicating copy to clipboard operation
VTable copied to clipboard

[Bug] 表头设置二级时,columns找不到类型

Open tangerball opened this issue 3 months ago • 3 comments

Version

1.20.0

Link to Minimal Reproduction

https://codesandbox.io/p/sandbox/vtable-list-table-forked-8dzz22?file=%2Fsrc%2Findex.ts%3A136%2C17

Steps to Reproduce

import { ColumnsDefine } from "@visactor/vtable";
const columnsList: ColumnsDefine = [
  {
    field: "id",
    title: "ID",
    width: 80,
    sort: true,
  },
  {
    field: "full name",
    title: "Full name",
    columns: [
      {
        field: "name",
        title: "First Name\n(input editor)",
        width: 120,
        editor: "input-editor",
      },
      {
        field: "lastName",
        title: "Last Name\n(input editor)",
        width: 100,
      },
    ],
  },
  {
    field: "sex",
    title: "sex\n(list editor)",
    width: 100,
  }
}

Current Behavior

二级表头的columns类型无法推导出来(为undefined),貌似还有很多类似情况,是否是类型未定义完整

Expected Behavior

希望能够提供完整可使用的类型

Environment

- OS:
- Browser:
- Framework:

Any additional comments?

No response

tangerball avatar Sep 29 '25 00:09 tangerball

定义 GroupColumnDefine 列,也就是有 columns 配置时不需要定义 field 字段

wumo1016 avatar Oct 09 '25 03:10 wumo1016

定义 GroupColumnDefine 列,也就是有 columns 配置时不需要定义 field 字段

这个没啥关系哈,主要是推导不出二级的columns类型

tangerball avatar Oct 20 '25 01:10 tangerball

不知道你说的“推导不出二级的columns类型”啥意思,反正我按你的去掉field字段配置后,写columns是有类型提示的,而且声明的 columnsList 的 columns 也有类型

wumo1016 avatar Oct 20 '25 01:10 wumo1016