Element-ui table表格的几种写法

默认写法

 <el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column
        prop="date"
        label="日期"
        width="180">
      </el-table-column>
      <el-table-column
        prop="name"
        label="姓名"
        width="180">
      </el-table-column>
    </el-table>

自定义单元格写法

slot-scopev-slot两种插槽方式。都可用。后一种是vue2.6后新方式。

<el-table
      :data="tableData"
      style="width: 100%">
      <el-table-column align="center" label="日期">
          <template slot-scope="scope">
            <span>{{ scope.row.date}}</span>
          </template>
        </el-table-column>
      <el-table-column align="center" label="姓名">
          <template v-slot:default="scope">
            <span>{{ scope.row.name}}</span>
          </template>
        </el-table-column>
    </el-table>
原创文章 103 获赞 128 访问量 3万+

猜你喜欢

转载自blog.csdn.net/qq_42991509/article/details/103503937
今日推荐