<template> <div> <el-table ref="multipleTable" :data="dataList" tooltip-effect="dark" style="width: 100%" @selection-change="handleSelectionChange"> <el-table-column type="selection" width="55"> </el-table-column> <el-table-column prop="name" label="名称"> <template slot-scope="scope">{{ scope.row.TopicName }}</template> </el-table-column> </el-table> <el-pagination background @current-change="handleCurrentChange" :page-size="msgFenlei.pageSize" layout="prev, pager, next" :total="totalFenlei"> </el-pagination> </div> </template> <script> export default { data() { return { dataList: [], totalFenlei: 0, msgFenlei: { pageIndex: 1, pageSize: 15, TopicName: "" }, selectRow:[] } }, methods: { handleCurrentChange(val) { this.msgFenlei.pageIndex = val; this.getFenleiList(); }, //获取数据 getFenleiList() { this.apipost("/api/MContent/GetTopicTypePageList", this.msgFenlei, res => { if (res.data.resultCode == 1) { this.dataList = res.data.data.pageData; this.totalFenlei = res.data.data.count; } else { this.Info(res.data.message); } }) }, handleSelectionChange(val){ this.selectRow=JSON.parse(JSON.stringify(val)); }, //父组件调用方法 getChoicedFenlei(){ return this.selectRow; }, //清空多选方法 toggleSelection(rows) { if (rows) { rows.forEach(row => { this.$refs.multipleTable.toggleRowSelection(row); }); } else { this.$refs.multipleTable.clearSelection(); } }, }, mounted() { this.getFenleiList(); } } </script>