效果展示
<el-table-column prop="img_list" label="热门展品排名" min-width="80"> <template
slot-scope="scope"> <div class="hot_list"> <i class="upward-icon" @click.stop="
sortUp(scope.$index,scope.row)">上</i> <i class="down-icon" @click.stop="
sortDown(scope.$index,scope.row)">下</i> </div> </template> </el-table-column>
sortUp(index, row) { console.log(index, row); if (index > 0) { let temp = this.
tableData[index - 1]; this.$set(this.tableData, index - 1, this.tableData[index]
); this.$set(this.tableData, index, temp); } }, sortDown(index, row) { console.
log(index, row); if (index < this.tableData.length - 1) { let i = this.tableData
[index + 1]; this.$set(this.tableData, index + 1, this.tableData[index]); this.$
set(this.tableData, index, i); } }