vue方法中获取el-table的下标和序号
<el-table :data="userDatas" border style="width: 90%"><el-table-column type="index" label="序号" width="100" align="center"></el-table-column><el-table-column prop="us...
·
<el-table :data="userDatas" border style="width: 90%">
<el-table-column type="index" label="序号" width="100" align="center"></el-table-column>
<el-table-column prop="userName" label="姓名" width="120" align="center"></el-table-column>
<el-table-column prop="userPhone" label="电话" width="150" align="center"></el-table-column>
<el-table-column prop="userAddress" label="地址" width="240" align="center"></el-table-column>
<el-table-column style="align: center" fixed="right" label="操作" width="200" align="center">
<template slot-scope="scope">
<el-button @click="handleClick(scope.$index)" type="text" size="small" icon="el-icon-edit">编辑</el-button>
<el-button @click="deleteUserByUserName(scope.row,scope.$index)" type="text" size="small" icon="el-icon-delete" style="color: red">删除</el-button>
</template>
</el-table-column>
</el-table>
type="index"
:就是显示序号scope.$index
:就是选中行的下标scope.row
:就是选中行的所有的信息- 例如:
scope.row.userName
:获取用户姓名
更多推荐
已为社区贡献1条内容
所有评论(0)