|
@@ -52,7 +52,7 @@
|
|
|
</div>
|
|
|
<div class="left_paneRight">
|
|
|
<el-scrollbar style="width: 100%; height: 100%" class="component-list scrollbar-wrapper">
|
|
|
- <draggable :list="extraImgs" itemKey="id" handle=".move" filter=".forbid" :force-fallback="false"
|
|
|
+ <draggable :list="componentLibrary" itemKey="id" handle=".move" filter=".forbid" :force-fallback="false"
|
|
|
chosen-class="chosenClass" animation="300" @start="onStart" @end="onEnd" :group="state.groupA"
|
|
|
:fallback-class="true" :fallback-on-body="true" :touch-start-threshold="50" :fallback-tolerance="50"
|
|
|
:move="onMove" :sort="false">
|
|
@@ -75,7 +75,8 @@
|
|
|
:handle="'.forbid'" :fallbackOnBody="false" :group="{ name: 'undraggable', pull: false, put: true }">
|
|
|
<template #item="{ element, index }">
|
|
|
<div class="item_module_center move">
|
|
|
- <VueDrag :index="index" :dargData="element" :id="element.id"></VueDrag>
|
|
|
+ {{ index }}
|
|
|
+ <VueDrag :index="index" :dargData="element" :key="index" @passId="getId"></VueDrag>
|
|
|
</div>
|
|
|
</template>
|
|
|
</draggable>
|
|
@@ -99,7 +100,7 @@
|
|
|
<div class="card_alignment">
|
|
|
<div class="bg_ment">
|
|
|
<div class="icon_item_align" :class="activate ? 'active_icon' : 'icon_item_gray'"
|
|
|
- v-for="( item, index ) in btnAlignment " :key="index" @click="alignment(item)">
|
|
|
+ v-for="( item, index ) in btnAlignment " :key="index" @click="alignment(item)">
|
|
|
<el-tooltip class="box-item" :content="item.label" placement="left" effect="light">
|
|
|
<span class="iconfont icon_alignment" :class="item.value"></span>
|
|
|
</el-tooltip>
|
|
@@ -116,7 +117,7 @@
|
|
|
</div>
|
|
|
</div>
|
|
|
</template>
|
|
|
-
|
|
|
+
|
|
|
<script lang="ts" setup>
|
|
|
import { DraggableContainer } from 'vue3-draggable-resizable'
|
|
|
import Draggable from "vuedraggable";
|
|
@@ -132,7 +133,6 @@ const tabPosition = ref<string>('style');
|
|
|
const activeName = ref<string>('bank');
|
|
|
// 默认选择组件库
|
|
|
const current = ref<string>('1');
|
|
|
-const deagRef = ref(null)
|
|
|
const imageUrl = new URL('@/assets/images/head.png', import.meta.url).href;
|
|
|
const btnOptions = [
|
|
|
{ label: "撤销", value: 'icon-chexiao' },
|
|
@@ -152,6 +152,7 @@ function getAssetsImages(name) {
|
|
|
}
|
|
|
|
|
|
const extraImgs = ref(attributeValue);
|
|
|
+const componentLibrary = JSON.parse(JSON.stringify(extraImgs.value))
|
|
|
const extraImgs1: any = ref([]);
|
|
|
const activate: any = ref(true);
|
|
|
const state = ref({
|
|
@@ -209,23 +210,39 @@ function preview() {
|
|
|
extraImgs1.value = extraImgs1.value
|
|
|
}
|
|
|
|
|
|
-function alignment(params: any) {
|
|
|
- if (params.type == 'left') {
|
|
|
- extraImgs1.value[0].css.left = 0
|
|
|
- } else if (params.type == 'centerHorizontally') {
|
|
|
- extraImgs1.value[0].css.left = 0
|
|
|
- } else if (params.type == 'right') {
|
|
|
- extraImgs1.value[0].css.left = 75
|
|
|
- } else if (params.type == 'top') {
|
|
|
- extraImgs1.value[0].css.top = 0
|
|
|
- } else if (params.type == 'verticalCenter') {
|
|
|
-
|
|
|
- } else if (params.type == 'bottom') {
|
|
|
+// 激活项索引
|
|
|
+const currentIndex: any = ref(null)
|
|
|
+function getId(params: any) {
|
|
|
+ console.log(params, 222);
|
|
|
|
|
|
+ currentIndex.value = params
|
|
|
+}
|
|
|
+// 对齐方式按钮触发
|
|
|
+function alignment(params: any) {
|
|
|
+ console.log(extraImgs1.value, 222);
|
|
|
+
|
|
|
+ if (currentIndex.value != null) {
|
|
|
+ if (params.type == 'left') {
|
|
|
+ extraImgs1.value[currentIndex.value].css.left = 0
|
|
|
+ } else if (params.type == 'centerHorizontally') {
|
|
|
+ const num = (375 / 2) - (extraImgs1.value[currentIndex.value].css.width / 2)
|
|
|
+ extraImgs1.value[currentIndex.value].css.left = num
|
|
|
+ } else if (params.type == 'right') {
|
|
|
+ const num = 375 - extraImgs1.value[currentIndex.value].css.width
|
|
|
+ extraImgs1.value[currentIndex.value].css.left = num
|
|
|
+ } else if (params.type == 'top') {
|
|
|
+ extraImgs1.value[currentIndex.value].css.top = 20
|
|
|
+ } else if (params.type == 'verticalCenter') {
|
|
|
+ const num = (667 / 2) - (extraImgs1.value[currentIndex.value].css.height / 2)
|
|
|
+ extraImgs1.value[currentIndex.value].css.top = num
|
|
|
+ } else if (params.type == 'bottom') {
|
|
|
+ const num = 667 - extraImgs1.value[currentIndex.value].css.height
|
|
|
+ extraImgs1.value[currentIndex.value].css.top = num
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
</script>
|
|
|
-
|
|
|
+
|
|
|
<style lang="scss" scoped>
|
|
|
.home-main-part {
|
|
|
min-width: 960px;
|