Parcourir la source

完善表单编辑器组件问题

快乐的梦鱼 il y a 1 semaine
Parent
commit
d0b6e41ae8

+ 4 - 4
src/common/components/form/RichTextEditor.vue

@@ -1,10 +1,10 @@
 <template>
   <view class="d-flex flex-col">
-    <Parse v-if="modelValue" :content="modelValue" />
+    <Parse v-if="modelValue" :content="modelValue" containerStyle="max-height:400px" />
     <text v-else>未编写内容,点击编写</text>
-    <view class="d-flex flex-row align-center gap-s mt-3">
-      <Button @click="preview">预览内容</Button>
-      <Button @click="edit" type="primary">编辑内容</Button>
+    <view class="d-flex flex-row gap-sss align-center mt-3">
+      <Button icon="browse" text="预览内容" size="small" @click="preview" />
+      <Button icon="edit" text="编辑内容" size="small" @click="edit" type="primary" />
     </view>
   </view>
 </template>

+ 5 - 4
src/components/basic/Button.vue

@@ -20,7 +20,7 @@
         :size="selectStyleType(size, 'medium', FonstSizes)"
         :color="themeContext.resolveThemeColor(loadingColor) || currentStyle.color"
         :innerStyle="{
-          marginRight: currentText ? '10rpx': undefined,
+          marginRight: iconMargin ? '10rpx': undefined,
         }"
       />
       <Icon
@@ -29,7 +29,7 @@
         :size="selectStyleType(size, 'medium', FonstSizes)"
         :color="currentStyle.color"
         :innerStyle="{
-          marginRight: currentText ? '10rpx': undefined,
+          marginRight: iconMargin ? '10rpx': undefined,
         }"
         v-bind="iconProps"
       />
@@ -50,7 +50,7 @@
         :size="selectStyleType(size, 'medium', FonstSizes)"
         :color="currentStyle.color"
         :innerStyle="{
-          marginLeft: currentText ? '10rpx' : undefined,
+          marginLeft: iconMargin ? '10rpx' : undefined,
         }"
         v-bind="rightIconProps"
       />
@@ -365,7 +365,8 @@ const currentStyle = computed(() => {
 
 const state = ref('');
 
-const currentText =  computed(() => props.loading ? (props.loadingText || props.text) : props.text);
+const currentText =  computed(() => (props.loading ? (props.loadingText || props.text) : props.text));
+const iconMargin = computed(() => Boolean(currentText.value));
 const textColorFinal = computed(() => (
   state.value === 'active' ?
     themeContext.resolveThemeColor(props.pressedTextColor) :

+ 1 - 1
src/pages/dig/forms/forms.ts

@@ -999,7 +999,7 @@ const villageInfoForm : Record<string, Record<number, SingleForm>> = {
               {
                 label: '概括',
                 name: 'overview',
-                type: 'textarea',
+                type: 'richtext',
                 defaultValue: '',
                 params: {
                   placeholder: '请输入概括',

+ 2 - 2
src/pages/editor/editor.vue

@@ -12,8 +12,8 @@
     ></sp-editor>
     
     <view class="d-flex flex-row align-center gap-s p-3">
-      <Button type="danger" @click="cancel">取消</Button>
-      <Button type="primary" @click="save">保存</Button>
+      <Button :innerStyle="{flex:1}" type="danger" @click="cancel">取消</Button>
+      <Button :innerStyle="{flex:1}" type="primary" @click="save">保存</Button>
     </view>
     <XBarSpace />
   </view>