插槽使用

预留插槽位

使用插槽需要现在列头数据对象(headerData)中定义插槽,slot字段指定插槽名称。

headerData内容示例,expand为定义的插槽

[
  {slot: "expand"},

  {
    id: 100,
    label: "日期",
    prop: "date",
    width: "150",

  },
  {
    id: 210,
    label: "姓名",
    prop: "name",
    width: "120",

  }
]

插槽使用

使用“template”标签 ,指定使用的插槽名称,格式如下:

<template #expand> </template>

在插槽内部定义行标签,以及行模板等操作。完整示例如下:

<yui-table
    :rowData="rowData数据对象"
    :headerData="headerData数据对象"
    :controlAtrr="controlAtrr数据对象"
>
</yui-table>
 <template #expand>
  <el-table-column type="expand" fixed width="60">
    <template #default="scope">
      <span slot-scope="scope">{{scope.row}}</span>
    </template>
  </el-table-column>
</template>

Last Updated:
Contributors: wangyifan