Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tableAttrs里添加elementui table的row-key属性不生效 #351

Open
Skura23 opened this issue Dec 23, 2021 · 0 comments
Open

tableAttrs里添加elementui table的row-key属性不生效 #351

Skura23 opened this issue Dec 23, 2021 · 0 comments

Comments

@Skura23
Copy link

Skura23 commented Dec 23, 2021

Describe the bug

tableAttrs里添加elementui table的row-key属性不生效

Screenshots

-

To Reproduce

Steps to reproduce the behavior:
elementui el-table文档:

支持树类型的数据的显示。当 row 中包含 children 字段时,被视为树形数据。渲染树形数据时,必须要指定 row-key。支持子节点数据异步加载。设置 Table 的 lazy 属性为 true 与加载函数 load 。通过指定 row 中的 hasChildren 字段来指定哪些行是包含子节点。children 与 hasChildren 都可以通过 tree-props 配置。

1, 在数据里带有children字段的情况下, 加入row-key设置:

// 模拟数据
onResponse: (result) => {
  const data = [{
    id: 2,
    parentId: 0,
    nameStr: '111',
    childrenExist: true,
    children: [
      {
        id: 3,
        parentId: 2,
        nameStr: '222',
        childrenExist: false,
      }
    ]
  }]
  return {
    data,
    total: 2
  }
  },

tableAttrs: {
  'row-key': 'id'
},

2, 仍报错 Error: for nested data item, row-key is required.

Expected behavior

支持elementui el-table原生的树功能

environment information

  • Version [e.g. 22] "@femessage/el-data-table": "^1.23.0", "element-ui": "2.13.2",
  • OS: win10
  • Browser chrome
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant