1
- # Intro
1
+ # 简介 Intro
2
2
3
- Vue-html5-editor is an html5 wysiwyg editor for vue,easy and flexible,compatible with Vue.js 1.0+.
3
+ Vue-html5-editor是一个Vue的富文本编辑器插件,简洁灵活可扩展,适用于vue2.0以上版本,支持IE11.
4
+
5
+ Vue-html5-editor is an html5 wysiwyg editor for vue,easy and flexible,compatible with Vue.js 2.0+,support IE11.
4
6
5
7
![ screenshot] ( http://tai.coding.me/vue-html5-editor/editor.png?v=20160912 )
6
8
7
- [ demo is here] ( http://tai.coding.me/vue-html5-editor )
9
+ [ 点击查看演示效果 Demo is here] ( http://tai.coding.me/vue-html5-editor )
8
10
9
- # Installation
11
+ # 安装 Installation
10
12
11
13
### Npm
12
14
@@ -15,29 +17,51 @@ Vue-html5-editor is an html5 wysiwyg editor for vue,easy and flexible,compatible
15
17
npm install vue-html5-editor --save-dev
16
18
```
17
19
20
+ 引入并安装作为全局组件
21
+
18
22
import and install as global component
19
23
20
24
``` js
21
- var Vue = require ( " vue" )
22
- var editor = require ( " vue-html5-editor" )
23
- Vue .use (editor ,options);
25
+ import Vue from ' vue'
26
+ import VueHtml5Editor from ' vue-html5-editor'
27
+ Vue .use (VueHtml5Editor ,options);
24
28
```
25
29
26
- ### browser
30
+ 同样你也可以作为局部组件使用,方便在不同的场景里使用不同的配置.
31
+
32
+ ``` js
33
+ const editor1 = new VueHtml5Editor (options1)
34
+ const app1 = new Vue ({
35
+ components: {editor1
36
+ }
37
+ })
38
+ const editor2 = new VueHtml5Editor (options2)
39
+ const app2 = new Vue ({
40
+ components: {editor2
41
+ }
42
+ })
43
+ ```
44
+
45
+
46
+ ### 浏览器直接使用 browser
27
47
28
48
``` html
29
49
<script src =" serverpath/vue.js" ></script >
30
50
<script src =" serverpath/vue-html5-editor.js" ></script >
31
51
```
32
- Install using global variable ` VueHtml5Editor `
52
+ 通过全局变量` VueHtml5Editor ` 来安装.
53
+
54
+ Install using global variable ` VueHtml5Editor ` .
33
55
``` js
34
56
Vue .use (VueHtml5Editor, options)
35
57
```
36
58
37
59
38
- # Usage
60
+ # 使用说明 Usage
61
+
62
+ 模板代码如下:
39
63
40
- template code as follows
64
+ template code as follows:
41
65
42
66
``` html
43
67
<vue-html5-editor :content =" content" :height =" 500" ></vue-html5-editor >
@@ -47,9 +71,11 @@ template code as follows
47
71
48
72
``` js
49
73
Vue .use (VueHtml5Editor, {
50
- // global component name
74
+ // 全局组件名称,使用new VueHtml5Editor(options)时该选项无效
75
+ // global component name
51
76
name: " vue-html5-editor" ,
52
- // custom icon class of built-in modules,default using font-awesome
77
+ // 自定义各个图标的class,默认使用的是font-awesome提供的图标
78
+ // custom icon class of built-in modules,default using font-awesome
53
79
icons: {
54
80
text: " fa fa-pencil" ,
55
81
color: " fa fa-paint-brush" ,
@@ -66,21 +92,27 @@ Vue.use(VueHtml5Editor, {
66
92
" full-screen" : " fa fa-arrows-alt" ,
67
93
info: " fa fa-info" ,
68
94
},
69
- // config image module
95
+ // 配置图片模块
96
+ // config image module
70
97
image: {
71
- // Url of the server-side,default null and convert image to base64
98
+ // 后端图片上传的地址,如果为空,默认转图片为base64
99
+ // Url of the server-side,default null and convert image to base64
72
100
server: null ,
73
- // the name for file field in multipart request
101
+ // 请求时表单参数名
102
+ // the name for file field in multipart request
74
103
fieldName: " image" ,
75
- // max file size
104
+ // 文件最大体积,单位字节 max file size
76
105
sizeLimit: 512 * 1024 ,
106
+ // 是否压缩,默认true,设置为true时会使用localResizeIMG进行压缩
77
107
// default true,if set to true,the image will resize by localResizeIMG (https://github.com/think2011/localResizeIMG)
78
108
compress: true ,
79
- // follows are options of localResizeIMG
109
+ // 图片压缩选项
110
+ // follows are options of localResizeIMG
80
111
width: 1600 ,
81
112
height: 1600 ,
82
113
quality: 80 ,
83
- // handle response data,return image url
114
+ // 响应数据处理
115
+ // handle response data,return image url
84
116
uploadHandler (responseText ){
85
117
// default accept json data like {ok:false,msg:"unexpected"} or {ok:true,data:"image url"}
86
118
var json = JSON .parse (responseText)
@@ -91,8 +123,10 @@ Vue.use(VueHtml5Editor, {
91
123
}
92
124
}
93
125
},
126
+ // 语言,内建的有英文(en-us)和中文(zh-cn)
94
127
// default en-us, en-us and zh-cn are built-in
95
128
language: " zh-cn" ,
129
+ // 自定义语言
96
130
i18n: {
97
131
// specify your language here
98
132
" zh-cn" : {
@@ -138,10 +172,12 @@ Vue.use(VueHtml5Editor, {
138
172
" reset" : " 重置"
139
173
}
140
174
},
141
- // the modules you don't want
175
+ // 隐藏不想要显示出来的模块
176
+ // the modules you don't want
142
177
hiddenModules: [],
143
- // keep only the modules you want and customize the order.
144
- // can be used with hiddenModules together
178
+ // 自定义要显示的模块,并控制顺序
179
+ // keep only the modules you want and customize the order.
180
+ // can be used with hiddenModules together
145
181
visibleModules: [
146
182
" text" ,
147
183
" color" ,
@@ -158,33 +194,42 @@ Vue.use(VueHtml5Editor, {
158
194
" full-screen" ,
159
195
" info" ,
160
196
],
161
- // extended modules
197
+ // 扩展模块,具体可以参考examples或查看源码
198
+ // extended modules
162
199
modules: {
163
200
// omit,reference to source code of build-in modules
164
201
}
165
202
})
166
203
```
167
204
168
- # attributes of component
205
+ # 组件属性 attributes of component
169
206
170
207
``` html
171
208
<editor :content.sync =" content" :height =" 500" :z-index =" 1000" :auto-height =" true" ></editor >
172
209
```
173
210
174
211
### content
175
212
176
- Content to edit,need two-way binding
213
+ 编辑内容
214
+
215
+ The html content to edit
177
216
178
217
### height
179
218
180
- The height or min-height ( if auto-height is true ) of editor
219
+ 编辑器高度,如果设置了` auto-height ` 为true,将设置为编辑器的最小高度.
220
+
221
+ The height or min-height ( if auto-height is true ) of editor.
181
222
182
223
### z-index
183
224
225
+ 层级,将会设置编辑器容量的` z-index ` 样式属性.
226
+
184
227
Sets z-index style property of editor
185
228
186
229
### auto-height
187
230
231
+ 是否自动根据内容控制编辑器高度.
232
+
188
233
Resize editor height Automatically
189
234
190
235
# License
0 commit comments