vue+element実装テーブルを上下に移動
11620 ワード
, , ,
vue this.$set(target,obj,resourse)
<el-table
v-if="testShow"
ref="interfaceTable"
class="com-table"
:height="tableHeight"
v-loading="loading"
element-loading-text=" ..."
element-loading-spinner="el-icon-loading"
element-loading-background="rgba(0, 0, 0, 0.8)"
:data="structureList"
border
:highlight-current-row="true"
:row-class-name="tableRowClassName" //
@row-click="rowClickFunc"
>
// row
// , index
tableRowClassName({
row, rowIndex }) {
var _this = this;
row.index = rowIndex;
if (_this.isTableActive) {
return "active-row ";
}
},
//
handleUp() {
var _this = this;
//tableIndex 0
if (_this.tableIndex == 0) {
_this.$message({
message: " , ",
type: "warning"
});
} else {
const len = _this.structureList[_this.tableIndex - 1];
this.$set(
_this.structureList,
_this.tableIndex - 1,
this.structureList[_this.tableIndex]
);
this.$set(_this.structureList, _this.tableIndex, len);
console.log(this.structureList);
this.$refs.interfaceTable.doLayout();
_this.tableIndex -= 1;
}
},
//
handleDown() {
var _this = this;
if (_this.tableIndex + 1 === _this.structureList.length) {
_this.$message({
message: " , ",
type: "warning"
});
} else {
const len = this.structureList[_this.tableIndex + 1];
this.$set(
this.structureList,
_this.tableIndex + 1,
this.structureList[_this.tableIndex]
);
this.$set(this.structureList, _this.tableIndex, len);
_this.tableIndex += 1;
}
},
, ,