wangeditor-team / wangEditor

wangEditor, open-source Web rich text editor 开源 Web 富文本编辑器
http://www.wangeditor.com/
MIT License
17.43k stars 3.31k forks source link

在Nuxt3上 使用不了 报Elemet is not defined #5335

Open cainiaodjm opened 1 year ago

cainiaodjm commented 1 year ago

bug 描述

请输入内容……

你预期的样子是?

请输入内容……

系统和浏览器及版本号

wangEditor 版本

请输入内容……

demo 能否复现该 bug ?

能/不能

在线 demo

请尽量提供在线 demo (推荐以下网站),帮助我们最低成本复现 bug

最小成本的复现步骤

(请告诉我们,如何最快的复现该 bug)

Naf9nahz commented 1 year ago

可以通过插件解决

const { $Editor, $Toolbar, $Boot } = useNuxtApp()
     <component
        :is="$Toolbar"
      />
      <component
        :is="$Editor"
      />
phcent commented 1 year ago

在plugins下创建wangEditor.client.ts

import { defineNuxtPlugin } from "#app";
import { Editor, Toolbar } from "@wangeditor/editor-for-vue";
import "@wangeditor/editor/dist/css/style.css";
export default defineNuxtPlugin((nuxtApp) => {
    nuxtApp.vueApp.component('Editor',Editor).component('Toolbar',Toolbar);
});
will196 commented 1 year ago

并不行

11003 commented 1 year ago
  <ClientOnly>
xxxx
    </ClientOnly>
lily1115 commented 6 months ago

在wangeditor组件里面 比如RichEditor.vue 文件名 改为RichEditor.client.vue 就行了 nuxt3文档上面有写 第三方组件 不想服务端渲染可以这样加