搜了一圈,没有找到合适的答案,自己研究写了一个,思路对了,写起来就比较简单
直接上代码,index.vue
<template>
<div style="position: relative">
<Editor
ref="targetRef"
v-bind="$attrs"
:style="editorStyle"
@onCreated="handleCreated"
@onChange="handleChange"
/>
<span ref="resizeRef" class="is-resize"> icon占位 </span>
</div>
</template>
<script setup lang="ts">
import "@wangeditor/editor/dist/css/style.css"; // 引入 css
import { onBeforeUnmount, shallowRef, computed, ref, CSSProperties } from "vue";
import { IDomEditor } from "@wangeditor/editor";
import { Editor } from "@wangeditor/editor-for-vue";
import { useResize } from "./use-resize";
const props = de