上移:
table 里列的 template里按钮
<el-button size="mini" type="text" @click="handleUp(scope.$index, scope.row)">上移</el-button>
<el-button size="mini" type="text" @click="handleDown(scope.$index, scope.row)">下移</el-button>
methods: {
handleUp (index, row) { // 上移
const len = this.tableData[index - 1]
this.$set(this.tableData, index - 1, this.tableData[index])
this.$set(this.tableData, index, len)
},
handleDown (index, row) { // 下移
const len = this.tableData[index + 1]
this.$set(this.tableData, index + 1, this.tableData[index])
this.$set(this.tableData, index, len)
}
}
使用$set 可更新视图