//向上
moveUp(node, data){
const parent = node.parent;
const children = parent.childNodes;
const index = children.findIndex(d => d.data.id === data.id);
let element = children[index];
children.splice(index, 1);
children.splice(index - 1, 0, element);
},
//向下
moveDown(node, data){
const parent = node.parent;
const children = parent.childNodes;
const index = children.findIndex(d => d.data.id === data.id);
let element = children[index];
children.splice(index, 1);
children.splice(index + 1, 0, element);
},
//删除
remove(node, data) {
const parent = node.parent;
const children = parent.data.child || parent.data;
const index = children.findIndex(d => d.id === data.id);
children.splice(index, 1);
},
element el-tree同级节点上下移动调换位置
最新推荐文章于 2024-08-07 11:00:54 发布