Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何在Nuxt3引入mavonEditor使用 #888

Open
freezyh opened this issue Dec 14, 2023 · 2 comments
Open

如何在Nuxt3引入mavonEditor使用 #888

freezyh opened this issue Dec 14, 2023 · 2 comments

Comments

@freezyh
Copy link

freezyh commented Dec 14, 2023

由于Nuxt升级了配置方式也发生了改变,如何正常引入该插件

@zhouzhouyaya
Copy link

由于Nuxt升级了配置方式也发生了改变,如何正常引入该插件

解决了吗

@xing403
Copy link

xing403 commented Jun 11, 2024

  1. install mavon-editor@next, current version is 3.0.1
  2. config nuxt.config
export default defineNuxtConfig({
  css: [
    'mavon-editor/dist/css/index.css', // import mavon-editor css
  ],
  plugins: [
    { src: '~/plugins/mavon-editor', mode: 'client' } // usage mavon-editor component
  ]
})
  1. edit ~/plugins/mavon-editor
import mavonEditor from 'mavon-editor';

export default defineNuxtPlugin((nuxtApp) => {
  nuxtApp.vueApp.use(mavonEditor);
})
  1. custom Editor component
<template>
  <ClientOnly>
    <mavon-editor v-model="model" w-full h-730px :toolbars="toolbarsConfig"/>
  </ClientOnly>
</template>

<script setup lang="ts">
const model = defineModel({ type: String }) // defineModel on Vue 3.4
const toolbarsConfig = {
  // ... toolbars config
}
</script>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants