liyongli 2 vuotta sitten
vanhempi
commit
9a63da42be

+ 4 - 3
src/view/allMedia/H5Editor.vue

@@ -37,7 +37,7 @@
                 :item="item"
                 :index="index + ''"
               ></h5-image>
-                <!-- @saveParagraph="text => saveParagraph(text, index)" -->
+              <!-- @saveParagraph="text => saveParagraph(text, index)" -->
               <h5-paragraph
                 v-if="item.type === 'paragraph'"
                 :item="item"
@@ -118,13 +118,14 @@ const H5EditorObj = {
   H5ImgEditor,
   H5VanFieldLeft,
   H5VanButtomLeft,
-  H5ParagraphLeft
+  H5ParagraphLeft,
 };
 const H5EditorObjEle = {
   image: 'H5ImgEditor',
   'van-field': 'H5VanFieldLeft',
   'van-buttom': 'H5VanButtomLeft',
-  paragraph: 'H5ParagraphLeft'
+  paragraph: 'H5ParagraphLeft',
+  fromComponent: 'H5ParagraphLeft',
 };
 
 const H5Editor = ref({});

+ 13 - 6
src/view/allMedia/components/H5Editor/from.vue

@@ -4,9 +4,9 @@
       <van-cell-group inset>
         <div
           class="text"
-          contenteditable
           v-text="item.title"
           :style="item.title_style"
+          @click="select"
         ></div>
         <slot></slot>
       </van-cell-group>
@@ -16,12 +16,21 @@
 </template>
 
 <script setup>
-import { defineProps } from 'vue';
+import { defineProps,inject } from 'vue';
 import 'vant/lib/index.css';
+const starEditorFormwork = inject('starEditorFormwork');
 
-defineProps({
+const props = defineProps({
   item: Object,
+  index: String
 });
+
+const select= () => {
+  const newItem = JSON.parse(JSON.stringify(props.item || {}));
+  newItem.leftEle = true;
+  newItem.nodetail = true;
+  starEditorFormwork(newItem, props.index);
+}
 </script>
 
 <style scoped>
@@ -31,8 +40,6 @@ defineProps({
 .text {
   outline: none;
   border: 1px solid #fff;
-}
-.text:focus {
-  border-color: red;
+  cursor: pointer;
 }
 </style>

+ 2 - 3
src/view/allMedia/components/H5EditorLeft/paragraph.vue

@@ -4,7 +4,7 @@
       <el-form-item label="标题">
         <el-input v-model="form.title" />
       </el-form-item>
-      <el-form-item label="内容">
+      <el-form-item label="内容" v-if="!item.item.nodetail">
         <div class="input" v-html="form.detail" contenteditable @input="setDate"></div>
       </el-form-item>
     </el-form>
@@ -23,9 +23,8 @@ const props = defineProps({
   item: Object,
   index: String,
 });
-
+console.log(props);
 const item = JSON.parse(JSON.stringify(props.item));
-console.log(item);
 const form = ref({
   title: item.item.title,
   detail: item.item.default_text,