赞
踩
- <el-table
- ref="videoList"
- :data="list"
- border
- style="width: 100%"
- @selection-change="setSelectRows"
- >
- <el-table-column type="selection" width="50"></el-table-column>
- </el-table>
-
-
- export default {
- data() {
- return {
- list: [],
- selectRows:[],
- }
- },
- methods: {
- //表格只能单选
- setSelectRows(selection) {
- this.selectRows = []
- if (selection.length > 1) {
- this.$refs.videoList.clearSelection()
- this.$refs.videoList.toggleRowSelection(
- selection[selection.length - 1]
- )
- }
- this.selectRows = [selection[selection.length - 1]]
- },
- }
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。