图层修改

qianlishi 4 years ago
parent 0aa75bc7c5
commit 210e30c83d

@ -10,7 +10,7 @@
<i class="iconfont iconjinlingyingcaiwangtubiao01"></i> 置顶图层
</div>
<div class="contentmenu__item" @click="setlowLayer">
<i class="iconfont iconleft-copy"></i> 图层
<i class="iconfont iconleft-copy"></i> 图层
</div>
<div class="contentmenu__item" @click="moveupLayer">
<i class="iconfont iconjinlingyingcaiwangtubiao01"></i> 上移一层

@ -30,7 +30,11 @@
</el-tab-pane>
<!-- 左侧图层-->
<el-tab-pane label="图层">
<draggable v-model="layerWidget">
<draggable
v-model="layerWidget"
@update="datadragEnd"
:options="{ animation: 300 }"
>
<transition-group>
<div
v-for="(item, index) in layerWidget"
@ -672,20 +676,61 @@ export default {
}
}
},
datadragEnd(evt) {
evt.preventDefault();
this.widgets = this.swapArr(this.widgets, evt.oldIndex, evt.newIndex);
},
//
swapArr(arr, oldIndex, newIndex) {
arr[oldIndex] = arr.splice(newIndex, 1, arr[oldIndex])[0];
return arr;
},
//
deletelayer() {
this.widgets.splice(this.rightClickIndex, 1);
},
//
copylayer() {},
copylayer() {
const obj = this.deepClone(this.widgets[this.rightClickIndex]);
this.widgets.splice(this.widgets.length, 0, obj);
},
//
istopLayer() {},
//
setlowLayer() {},
istopLayer() {
if (this.rightClickIndex != 0) {
this.widgets.unshift(this.widgets.splice(this.rightClickIndex, 1)[0]);
}
},
//
setlowLayer() {
if (this.rightClickIndex + 1 < this.widgets.length) {
const temp = this.widgets.splice(this.rightClickIndex, 1)[0];
this.widgets.push(temp);
}
},
//
moveupLayer() {},
moveupLayer() {
if (this.rightClickIndex != 0) {
this.widgets[this.rightClickIndex] = this.widgets.splice(
this.rightClickIndex - 1,
1,
this.widgets[this.rightClickIndex]
)[0];
} else {
this.widgets.push(this.widgets.shift());
}
},
//
movedownLayer() {}
movedownLayer() {
if (this.rightClickIndex != this.widgets.length - 1) {
this.widgets[this.rightClickIndex] = this.widgets.splice(
this.rightClickIndex + 1,
1,
this.widgets[this.rightClickIndex]
)[0];
} else {
this.widgets.unshift(this.widgets.splice(this.rightClickIndex, 1)[0]);
}
}
}
};
</script>

Loading…
Cancel
Save