美文网首页
表格el-table和template使用

表格el-table和template使用

作者: 每天进步一点点5454 | 来源:发表于2020-07-03 11:33 被阅读0次

: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>

相关文章