element-tree-grid icon indicating copy to clipboard operation
element-tree-grid copied to clipboard

expand-all="!!1"数据多层级的时候会卡死浏览器

Open xt981224 opened this issue 5 years ago • 11 comments

expand-all="!!1"数据多层级的时候会卡死浏览器

xt981224 avatar Sep 23 '20 08:09 xt981224

需求是展开所有层级

xt981224 avatar Sep 23 '20 08:09 xt981224

可以提供简单的代码么?

foolishchow avatar Sep 23 '20 08:09 foolishchow

我的版本是0.15 <el-table-tree-column id="box" :remote="remote" expandAll="true" treeKey="id" parent-key="parent_id" prop="categoryName" width="200px" label="类目名称" >

xt981224 avatar Sep 23 '20 08:09 xt981224

<el-table-tree-column id="box" :remote="remote" expandAll="true" treeKey="id" parent-key="parent_id" prop="categoryName" width="200px" label="类目名称" >

xt981224 avatar Sep 23 '20 08:09 xt981224

我怎么给你呢 Uploading image.png…

xt981224 avatar Sep 23 '20 08:09 xt981224

方便微信吗

xt981224 avatar Sep 23 '20 08:09 xt981224

<el-table-tree-column id="box" :remote="remote" expandAll="true" treeKey="id" parent-key="parent_id" prop="categoryName" width="200px" label="类目名称" > </el-table-tree-column>

xt981224 avatar Sep 23 '20 08:09 xt981224

你看下我的代码,remote属性是不是正确设置了

//这是我们的jsx
<Table border data={this.list} on-selection-change={this.handleSelectionChange}>
            <TableColumn type="selection" width="120" align="center"></TableColumn>
            <FwTreeColumn label="分类名称" prop="name"
              fileIcon="icon icon-file" folderIcon="icon icon-folder"
              treeKey="id" parentKey="parent_id" allRemote
              remote={this.loadChild}></FwTreeColumn>
            <TableColumn label="操作" scopedSlots={{ default: this.renderOpt }}></TableColumn>
</Table>

//remote指向的加载
  private loadChild(row: Entity, callBack: (data: Entity[]) => void) {
    let child: Entity[] = row.children
    let d = child.map(i => {
      i.parent_id = row.id;
      i.depth = (row.depth || 0) + 1;
      return i;
    })
    callBack(d)
  }

foolishchow avatar Sep 23 '20 08:09 foolishchow

`<el-table-tree-column treeKey="id" expandAll="!!1" parentKey="parent_id" prop="brandName" :remote="remote" width="200px" label="品牌名称"

  >
  <template slot-scope="scope">
    <span>{{scope.row.brandName}}</span>
  </template>
  </el-table-tree-column>`

xt981224 avatar Sep 23 '20 08:09 xt981224

TypeError: Cannot read property 'some' of undefined"

xt981224 avatar Sep 23 '20 08:09 xt981224

Cannot read property 'some' of undefined at isNeedExpanedRow (tree-table.common.js?42e3:120)

xt981224 avatar Sep 23 '20 08:09 xt981224