|
@@ -1,8 +1,20 @@
|
|
|
<template>
|
|
|
<div class="H5Editor">
|
|
|
- <div class="H5Editor_left">
|
|
|
- <component v-show="H5Editor" :is="H5EditorObj[H5Editor.type]" :item="H5Editor"></component>
|
|
|
- </div>
|
|
|
+ <van-popup
|
|
|
+ v-model:show="leftEle"
|
|
|
+ position="left"
|
|
|
+ :style="{
|
|
|
+ width: '300px',
|
|
|
+ 'background-color': '#f3f3f3',
|
|
|
+ height: '100%',
|
|
|
+ }"
|
|
|
+ >
|
|
|
+ <component
|
|
|
+ v-if="H5Editor && leftEle"
|
|
|
+ :is="H5EditorObj[H5Editor.type]"
|
|
|
+ :item="H5Editor"
|
|
|
+ ></component>
|
|
|
+ </van-popup>
|
|
|
<div class="H5Editor_center">
|
|
|
<div class="pageClient">
|
|
|
<div class="page">
|
|
@@ -33,10 +45,16 @@
|
|
|
<h5-van-field
|
|
|
v-if="v.type === 'van-field'"
|
|
|
:item="v"
|
|
|
+ @click="
|
|
|
+ () => selectComponent({ ...v, leftEle: true }, index)
|
|
|
+ "
|
|
|
></h5-van-field>
|
|
|
<h5-van-buttom
|
|
|
v-if="v.type === 'van-buttom'"
|
|
|
:item="v"
|
|
|
+ @click="
|
|
|
+ () => selectComponent({ ...v, leftEle: true }, index)
|
|
|
+ "
|
|
|
></h5-van-buttom>
|
|
|
</template>
|
|
|
</h5-from-component>
|
|
@@ -71,16 +89,23 @@ import H5VanField from './components/H5Editor/van_field.vue';
|
|
|
import H5VanButtom from './components/H5Editor/van_buttom.vue';
|
|
|
|
|
|
// 左侧编辑模块组件
|
|
|
-import H5ImgEditor from "./components/H5Editor/imgEditor";
|
|
|
+import H5ImgEditor from './components/H5EditorLeft/imgEditor';
|
|
|
+import H5VanFieldLeft from './components/H5EditorLeft/vanField';
|
|
|
+import H5VanButtomLeft from './components/H5EditorLeft/vanButtom';
|
|
|
|
|
|
const H5EditorObj = {
|
|
|
- H5ImgEditor
|
|
|
-}
|
|
|
+ H5ImgEditor,
|
|
|
+ H5VanFieldLeft,
|
|
|
+ H5VanButtomLeft,
|
|
|
+};
|
|
|
const H5EditorObjEle = {
|
|
|
- "image": "H5ImgEditor"
|
|
|
-}
|
|
|
+ image: 'H5ImgEditor',
|
|
|
+ 'van-field': 'H5VanFieldLeft',
|
|
|
+ 'van-buttom': 'H5VanButtomLeft',
|
|
|
+};
|
|
|
|
|
|
const H5Editor = ref({});
|
|
|
+const leftEle = ref(false);
|
|
|
const route = useRoute();
|
|
|
const item = JSON.parse(route.query.item || '{}');
|
|
|
const selectPage = ref(0);
|
|
@@ -89,6 +114,11 @@ const page = ref({ width: 375, height: 0 });
|
|
|
const selectPageFunc = (index = 0) => {
|
|
|
selectPage.value = index;
|
|
|
};
|
|
|
+const selectComponent = v => {
|
|
|
+ const type = H5EditorObjEle[v.type];
|
|
|
+ H5Editor.value = { item: v, type };
|
|
|
+ leftEle.value = v.leftEle || false;
|
|
|
+};
|
|
|
|
|
|
// 查看页面大小,
|
|
|
const img = new Image();
|
|
@@ -116,18 +146,16 @@ const saveParagraph = (paragraph, index) => {
|
|
|
|
|
|
// provide 传递方法
|
|
|
provide('starEditorFormwork', value => {
|
|
|
- const type = H5EditorObjEle[value.type];
|
|
|
- value.type = type;
|
|
|
- H5Editor.value = value;
|
|
|
+ selectComponent(value);
|
|
|
});
|
|
|
|
|
|
-provide("saveComponents", value => {
|
|
|
- console.log(value);
|
|
|
-})
|
|
|
+provide('saveComponents', value => {
|
|
|
+ console.log(value);
|
|
|
+});
|
|
|
|
|
|
-provide("deleteItemComponents", value => {
|
|
|
- console.log(value);
|
|
|
-})
|
|
|
+provide('deleteItemComponents', value => {
|
|
|
+ console.log(value);
|
|
|
+});
|
|
|
</script>
|
|
|
|
|
|
<style scoped>
|
|
@@ -144,7 +172,6 @@ provide("deleteItemComponents", value => {
|
|
|
min-width: 1200px;
|
|
|
}
|
|
|
|
|
|
-.H5Editor_left,
|
|
|
.H5Editor_center,
|
|
|
.H5Editor_right {
|
|
|
display: inline-block;
|
|
@@ -152,7 +179,7 @@ provide("deleteItemComponents", value => {
|
|
|
}
|
|
|
|
|
|
.H5Editor_center {
|
|
|
- width: calc(100% - 600px);
|
|
|
+ width: calc(100% - 300px);
|
|
|
position: relative;
|
|
|
}
|
|
|
|
|
@@ -186,11 +213,6 @@ provide("deleteItemComponents", value => {
|
|
|
background-color: #f3f3f3;
|
|
|
}
|
|
|
|
|
|
-.H5Editor_left {
|
|
|
- width: 300px;
|
|
|
- background-color: #f3f3f3;
|
|
|
-}
|
|
|
-
|
|
|
.H5Editor_right .selectPage {
|
|
|
border: 3px solid #409eff;
|
|
|
}
|