diff --git a/src/components/editor/index.vue b/src/components/editor/index.vue index 55f42053..78e57262 100644 --- a/src/components/editor/index.vue +++ b/src/components/editor/index.vue @@ -1,7 +1,7 @@ @@ -13,6 +13,8 @@ import { toolbarKeys } from './toolbar'; // 定义接口来定义对象的类型 interface WangeditorState { + editorToolbar: HTMLDivElement | null; + editorContent: HTMLDivElement | null; editor: any; } @@ -51,7 +53,9 @@ export default defineComponent({ }, setup(props, { emit }) { const state = reactive({ + editorToolbar: null, editor: null, + editorContent: null, }); // 富文本配置 const wangeditorConfig = () => { @@ -79,13 +83,13 @@ export default defineComponent({ const initWangeditor = () => { state.editor = createEditor({ html: props.modelValue, - selector: `#${props.id}`, + selector: state.editorContent!, config: wangeditorConfig(), mode: props.mode, }); createToolbar({ editor: state.editor, - selector: '#editor-toolbar', + selector: state.editorToolbar!, mode: props.mode, config: toolbarConfig(), }); diff --git a/src/layout/routerView/iframes.vue b/src/layout/routerView/iframes.vue index 91bd347b..43e71c51 100644 --- a/src/layout/routerView/iframes.vue +++ b/src/layout/routerView/iframes.vue @@ -1,6 +1,6 @@ @@ -20,6 +20,7 @@ export default defineComponent({ const { isTagsViewCurrenFull } = storeToRefs(storesTagsViewRoutes); const route = useRoute(); const state = reactive({ + iframeDom: null as HTMLIFrameElement | null, iframeLoading: true, iframeUrl: '', }); @@ -28,7 +29,7 @@ export default defineComponent({ state.iframeUrl = route.meta.isLink; nextTick(() => { state.iframeLoading = true; - const iframe = document.getElementById('iframe'); + const iframe = state.iframeDom; if (!iframe) return false; iframe.onload = () => { state.iframeLoading = false; diff --git a/src/views/fun/clipboard/index.vue b/src/views/fun/clipboard/index.vue index 57edd00c..a92eed01 100644 --- a/src/views/fun/clipboard/index.vue +++ b/src/views/fun/clipboard/index.vue @@ -1,20 +1,18 @@