vue3 使用wangeditor
时间: 2023-11-28 13:43:15 浏览: 80
vue3-wangeditor:基于Wangeditor富文本编辑器,用于Vue3.x的组件
5星 · 资源好评率100%
以下是在Vue3中使用WangEditor的步骤:
1. 安装WangEditor和WangEditor的Vue组件
```bash
npm install @wangeditor/editor --save
npm install @wangeditor/editor-for-vue@next --save
```
2. 在Vue组件中引入WangEditor
```vue
<template>
<div>
<wangeditor v-model="content" />
</div>
</template>
<script>
import { WangEditor, WangEditorVue } from '@wangeditor/editor-for-vue'
export default {
components: {
WangEditor
},
data() {
return {
content: ''
}
}
}
</script>
```
3. 在Vue应用程序中注册WangEditorVue组件
```javascript
import { createApp } from 'vue'
import App from './App.vue'
import { WangEditorVue } from '@wangeditor/editor-for-vue'
const app = createApp(App)
app.use(WangEditorVue)
app.mount('#app')
```
阅读全文