table列表上有一個(gè)上移下移的功能
點(diǎn)擊進(jìn)行排序凉倚,數(shù)據(jù)為labelList量承。
up(index) {
const list = [ ...this.labelList ]
if (index < 1) {
this.$modal.msgError("已經(jīng)是第一個(gè)了妓局,無法上移");
this.labelList = [ ...list ]
} else {
list[index] = list.splice(index - 1, 1, list[index])[0]
this.labelList = [ ...list ]
}
},
down(index) {
const list = [ ...this.labelList ]
if (index >= list.length - 1) {
this.$modal.msgError("已經(jīng)是最后一個(gè)了屡久,無法下移");
this.labelList = [ ...list ]
} else {
list[index] = list.splice(index + 1, 1, list[index])[0]
this.labelList = [ ...list ]
}
},
然后刪除
delete(index) {
this.labelList.splice(index, 1);
}
新增
addLabel() {
const data = { tagName: "", inOut: true };
this.labelList.push(data);
},