Your Name
2022-08-25 0203ef4d930ba7a56996debad9d14c9528390fba
src/components/editor/index.vue
@@ -24,17 +24,17 @@
      // 节点 id
      id: {
         type: String,
         default: () => 'wangeditor',
            default: () => 'wangeditor'
      },
      // 是否禁用
      isDisable: {
         type: Boolean,
         default: () => false,
            default: () => false
      },
      // 内容框默认 placeholder
      placeholder: {
         type: String,
         default: () => '请输入内容',
            default: () => '请输入内容'
      },
      // 双向绑定:双向绑定值,字段名为固定,改了之后将不生效
      // 参考:https://v3.cn.vuejs.org/guide/migration/v-model.html#%E8%BF%81%E7%A7%BB%E7%AD%96%E7%95%A5
@@ -43,19 +43,19 @@
      // 模式,可选 <default|simple>,默认 default
      mode: {
         type: String,
         default: () => 'default',
            default: () => 'default'
      },
      // 高度
      height: {
         type: String,
         default: () => '310px',
      },
            default: () => '310px'
        }
   },
   setup(props, { emit }) {
      const state = reactive<WangeditorState>({
         editorToolbar: null,
         editor: null,
         editorContent: null,
            editorContent: null
      });
      // 富文本配置
      const wangeditorConfig = () => {
@@ -68,7 +68,7 @@
            emit('update:modelValue', editor.getHtml());
         };
         (<any>editorConfig).MENU_CONF['uploadImage'] = {
            base64LimitSize: 10 * 1024 * 1024,
                base64LimitSize: 10 * 1024 * 1024
         };
         return editorConfig;
      };
@@ -85,13 +85,13 @@
            html: props.modelValue,
            selector: state.editorContent!,
            config: wangeditorConfig(),
            mode: props.mode,
                mode: props.mode
         });
         createToolbar({
            editor: state.editor,
            selector: state.editorToolbar!,
            mode: props.mode,
            config: toolbarConfig(),
                config: toolbarConfig()
         });
      };
      // 页面加载时
@@ -108,8 +108,8 @@
         }
      );
      return {
         ...toRefs(state),
            ...toRefs(state)
      };
   },
    }
});
</script>