表格el-table和template使用
2020-07-03 本文已影响0人
每天进步一点点5454
:data是要渲染的数据
slot-scope="scope"定义模板
scope 是随便起的名字,通过scope获取数据
scope.row.time可以获取到数据
<el-table :data="tableData" border style="width: 100%;text-align: center;" height="360">
<el-table-column label="序号" width="180">
<template slot-scope="scope">
//这个是整行设置序号
<span style="margin-left: 10px">{{scope.$index + 1}}</span>
</template>
</el-table-column>
</el-table>