Skip to content

Commit b36e507

Browse files
committed
发布:3.9.0
1 parent 6c14ffe commit b36e507

1 file changed

Lines changed: 120 additions & 12 deletions

File tree

README.md

Lines changed: 120 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,26 @@
4242
</script>
4343
```
4444

45-
### vue双向绑定
45+
### vue2 使用
4646

47-
安装UEditor插件支持
47+
安装插件支持
4848

4949
```shell
50-
npm i vue-ueditor-wrap
50+
npm i --save vue-ueditor-wrap@2.x
5151
#
52-
yarn add vue-ueditor-wrap
52+
yarn add --save vue-ueditor-wrap@2.x
5353
```
5454

55-
② 解压 UEditorPlus 到静态资源目录,配置
55+
② 解压 UEditorPlus 到静态资源目录
56+
57+
复制 `dist-min` 到项目 `public/static/UEditorPlus/` 目录
58+
59+
③ 引入组件并使用
5660

5761
```html
5862

5963
<template>
60-
<div class="content">
64+
<div>
6165
<vue-ueditor-wrap v-model="content"
6266
editor-id="editor"
6367
:config="editorConfig"
@@ -66,24 +70,128 @@ yarn add vue-ueditor-wrap
6670
</div>
6771
</template>
6872
<script>
73+
import VueUeditorWrap from 'vue-ueditor-wrap'
74+
6975
export default {
76+
components: {
77+
VueUeditorWrap
78+
},
7079
data() {
7180
return {
7281
content: '<p>Hello UEditorPlus</p>',
7382
editorConfig: {
74-
// 编辑器后端服务接口,参考后端规范 https://open-doc.modstart.com/ueditor-plus/backend.html
75-
serverUrl: '后端服务',
76-
// 配置 UEditorPlus 的静态资源根路径,可以是 CDN 的静态资源地址
77-
UEDITOR_HOME_URL: '/static/UEditorPlus',
78-
UEDITOR_CORS_URL: '/static/UEditorPlus'
83+
// 后端服务地址,后端处理参考
84+
// https://open-doc.modstart.com/ueditor-plus/backend.html
85+
serverUrl: '/api/path/to/server',
86+
UEDITOR_HOME_URL: '/static/UEditorPlus/',
87+
UEDITOR_CORS_URL: '/static/UEditorPlus/',
7988
}
8089
}
8190
}
8291
}
8392
</script>
8493
```
8594

86-
更多配置和使用参考:[vue-ueditor-wrap](https://hc199421.gitee.io/vue-ueditor-wrap)
95+
### vue3 使用
96+
97+
① 安装插件支持
98+
99+
```shell
100+
npm i --save vue-ueditor-wrap@3.x
101+
#
102+
yarn add --save vue-ueditor-wrap@3.x
103+
```
104+
105+
② 解压 UEditorPlus 到静态资源目录
106+
107+
复制 `dist-min` 到项目 `public/static/UEditorPlus/` 目录
108+
109+
③ 引入组件并使用
110+
111+
**main.js**
112+
113+
```javascript
114+
import {createApp} from 'vue'
115+
import App from './App.vue'
116+
import VueUeditorWrap from 'vue-ueditor-wrap';
117+
118+
createApp(App).use(VueUeditorWrap).mount('#app')
119+
```
120+
121+
**App.vue**
122+
123+
```html
124+
125+
<template>
126+
<div>
127+
<vue-ueditor-wrap v-model="content"
128+
editor-id="editor"
129+
:config="editorConfig"
130+
:editorDependencies="['ueditor.config.js','ueditor.all.js']"
131+
style="height:500px;"/>
132+
</div>
133+
</template>
134+
135+
<script setup>
136+
import {ref} from 'vue';
137+
138+
const content = ref('<p>Hello UEditorPlus</p>');
139+
const editorConfig = {
140+
// 后端服务地址,后端处理参考
141+
// https://open-doc.modstart.com/ueditor-plus/backend.html
142+
serverUrl: '/api/path/to/server',
143+
UEDITOR_HOME_URL: '/static/UEditorPlus/',
144+
UEDITOR_CORS_URL: '/static/UEditorPlus/',
145+
}
146+
</script>
147+
```
148+
149+
### react 使用
150+
151+
① 安装插件支持
152+
153+
```shell
154+
npm i --save react-ueditor-wrap
155+
#
156+
yarn add --save react-ueditor-wrap
157+
```
158+
159+
② 解压 UEditorPlus 到静态资源目录
160+
161+
复制 `dist-min` 到项目 `public/static/UEditorPlus/` 目录
162+
163+
③ 引入组件并使用
164+
165+
```jsx
166+
import RcUeditor from 'react-ueditor-wrap';
167+
168+
function App() {
169+
const hanldeChage = (value) => {
170+
console.log('RcUeditor', value);
171+
}
172+
return (
173+
<div className="App">
174+
<div style={{margin: '0 auto', maxWidth: '800px'}}>
175+
<RcUeditor
176+
value={'<p>Hello UEditorPlus</p>'}
177+
ueditorUrl={'/static/UEditorPlus/ueditor.all.js'}
178+
ueditorConfigUrl={'/static/UEditorPlus/ueditor.config.js'}
179+
editorConfig={{
180+
// 后端服务地址,后端处理参考
181+
// https://open-doc.modstart.com/ueditor-plus/backend.html
182+
initialFrameWidth: '100%',
183+
serverUrl: '/api/path/to/server',
184+
UEDITOR_HOME_URL: '/static/UEditorPlus/',
185+
UEDITOR_CORS_URL: '/static/UEditorPlus/',
186+
}}
187+
onChange={hanldeChage}/>
188+
</div>
189+
</div>
190+
);
191+
}
192+
193+
export default App;
194+
```
87195

88196
## 关于Bug反馈与维护
89197

0 commit comments

Comments
 (0)