Skip to content

Commit e83a434

Browse files
committed
Merge remote-tracking branch 'origin/master' into master
2 parents 815d208 + 865cb33 commit e83a434

File tree

1 file changed

+57
-49
lines changed

1 file changed

+57
-49
lines changed

README-zh_CN.md

Lines changed: 57 additions & 49 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ vue-grid-layout是一个类似于[Gridster](http://dsmorse.github.io/gridster.js
99
### **当前版本:** 2.3.8 (支持 Vue 2.2+)
1010

1111
### **Vue 2.1.10 及以下请使用 [2.1.3](https://github.com/jbaysolutions/vue-grid-layout/tree/2.1.3)**
12-
### **Vue 1 请使用 [1.0.3](https://github.com/jbaysolutions/vue-grid-layout/tree/1.0.3)**
12+
### **Vue 1 请使用 [1.0.3](https://github.com/jbaysolutions/vue-grid-layout/tree/1.0.3)**
1313

1414
<br/>
1515

@@ -64,10 +64,10 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
6464

6565
#### npm
6666

67-
# 使用 npm
67+
# 使用 npm
6868
npm install vue-grid-layout --save
69-
70-
# 使用 yarn
69+
70+
# 使用 yarn
7171
yarn add vue-grid-layout
7272

7373

@@ -77,7 +77,7 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
7777
import VueGridLayout from 'vue-grid-layout';
7878
```
7979

80-
加入到 Vue 组件
80+
加入到 Vue 组件
8181

8282
```javascript
8383
export default {
@@ -87,8 +87,8 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
8787
},
8888
// ... data, methods, mounted (), etc.
8989
}
90-
91-
```
90+
91+
```
9292

9393
#### 浏览器
9494

@@ -123,14 +123,14 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
123123
{"x":0,"y":9,"w":2,"h":3,"i":"18"},
124124
{"x":2,"y":6,"w":2,"h":2,"i":"19"}
125125
];
126-
126+
127127
new Vue({
128128
el: '#app',
129129
data: {
130130
layout: testLayout,
131131
},
132132
});
133-
```
133+
```
134134

135135

136136
```html
@@ -167,38 +167,46 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
167167
##### GridLayout
168168

169169
* **layout**
170-
170+
171171
* type: `Array`
172172
* required: `true`
173173

174174
数据源。值必须为 `Array`,其数据项为 `Object`。 每条数据项必须有 `i`, `x`, `y`, `w``h` 属性。 请参考下面的 `GridItem`
175175

176+
* **responsiveLayouts**
177+
178+
* type: `Object`
179+
* required: `false`
180+
* default: `{}`
181+
182+
如果 `responsive` 设置为 `true`,该配置将作为栅格中每个断点的初始布局。键值是断点名称,每项的值都是类似 `layout` 属性定义的数据结构,值必须为 `Array`,其数据项为 `Object`。例如: `{lg: [layout items], md: [layout items]}`。需要注意的是,在创建栅格布局后设置该属性无效。
183+
176184
* **colNum**
177-
185+
178186
* type: `Number`
179187
* required: `false`
180188
* default: `12`
181189

182190
定义栅格系统的列数,其值需为自然数。
183191

184192
* **rowHeight**
185-
193+
186194
* type: `Number`
187195
* required: `false`
188196
* default: `150`
189197

190198
每行的高度,单位像素。
191199

192200
* **maxRows**
193-
201+
194202
* type: `Number`
195203
* required: `false`
196204
* default: `Infinity`
197205

198206
定义最大行数。
199207

200208
* **margin**
201-
209+
202210
* type: `Array`
203211
* required: `false`
204212
* default: `[10, 10]`
@@ -208,55 +216,55 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
208216
值必须是包含两个 `Number`的数组,数组中第一个元素表示水平边距,第二个表示垂直边距,单位为像素。
209217

210218
* **isDraggable**
211-
219+
212220
* type: `Boolean`
213221
* required: `false`
214222
* default: `true`
215223

216224
标识栅格中的元素是否可拖拽。
217225

218226
* **isResizable**
219-
227+
220228
* type: `Boolean`
221229
* required: `false`
222230
* default: `true`
223231

224232
标识栅格中的元素是否可调整大小。
225233

226234
* **isMirrored**
227-
235+
228236
* type: `Boolean`
229237
* required: `false`
230238
* default: `false`
231239

232240
标识栅格中的元素是否可镜像反转。
233241

234242
* **autoSize**
235-
243+
236244
* type: `Boolean`
237245
* required: `false`
238246
* default: `true`
239247

240248
标识容器是否自动调整大小。
241249

242250
* **verticalCompact**
243-
251+
244252
* type: `Boolean`
245253
* required: `false`
246254
* default: `true`
247255

248256
标识布局是否垂直压缩。
249257

250258
* **useCssTransforms**
251-
259+
252260
* type: `Boolean`
253261
* required: `false`
254262
* default: `true`
255263

256264
标识是否使用CSS属性 `transition-property: transform;`
257265

258266
* **responsive**
259-
267+
260268
* type: `Boolean`
261269
* required: `false`
262270
* default: `false`
@@ -283,106 +291,106 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
283291
##### GridItem
284292

285293
* **i**
286-
294+
287295
* type: `String`
288296
* required: `true`
289297

290298
栅格中元素的ID。
291299

292300
* **x**
293-
301+
294302
* type: `Number`
295303
* required: `true`
296304

297305
标识栅格元素位于第几列,需为自然数。
298306

299307
* **y**
300-
308+
301309
* type: `Number`
302310
* required: `true`
303311

304312
标识栅格元素位于第几行,需为自然数。
305313

306314
* **w**
307-
315+
308316
* type: `Number`
309317
* required: `true`
310318

311319
标识栅格元素的初始宽度,值为`colWidth`的倍数。
312320

313321
* **h**
314-
322+
315323
* type: `Number`
316324
* required: `true`
317325

318326
标识栅格元素的初始高度,值为`rowHeight`的倍数。
319327

320328
* **minW**
321-
329+
322330
* type: `Number`
323331
* required: `false`
324332
* default: `1`
325333

326334
栅格元素的最小宽度,值为`colWidth`的倍数。
327-
335+
328336
如果`w`小于`minW`,则`minW`的值会被`w`覆盖。
329337

330338
* **minH**
331-
339+
332340
* type: `Number`
333341
* required: `false`
334342
* default: `1`
335343

336344
栅格元素的最小高度,值为`rowHeight`的倍数。
337-
345+
338346
如果`h`小于`minH`,则`minH`的值会被`h`覆盖。
339347

340348
* **maxW**
341-
349+
342350
* type: `Number`
343351
* required: `false`
344352
* default: `Infinity`
345353

346354
栅格元素的最大宽度,值为`colWidth`的倍数。
347-
355+
348356
如果`w`大于`maxW`,则`maxW`的值会被`w`覆盖。
349357

350358
* **maxH**
351-
359+
352360
* type: `Number`
353361
* required: `false`
354362
* default: `Infinity`
355363

356364
栅格元素的最大高度,值为`rowHeight`的倍数。
357-
365+
358366
如果`h`大于`maxH`,则`maxH`的值会被`h`覆盖。
359367

360368
* **isDraggable**
361-
369+
362370
* type: `Boolean`
363371
* required: `false`
364372
* default: `null`
365373

366374
标识栅格元素是否可拖拽。如果值为`null`则取决于父容器。
367375

368376
* **isResizable**
369-
377+
370378
* type: `Boolean`
371379
* required: `false`
372380
* default: `null`
373381

374382
标识栅格元素是否可调整大小。如果值为`null`则取决于父容器。
375383

376384
* **static**
377-
385+
378386
* type: `Boolean`
379387
* required: `false`
380388
* default: `false`
381389

382390
标识栅格元素是否为静态的(无法拖拽、调整大小或被其他元素移动)。
383391

384392
* **dragIgnoreFrom**
385-
393+
386394
* type: `String`
387395
* required: `false`
388396
* default: `'a, button'`
@@ -392,7 +400,7 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
392400
请参考 [interact.js docs](http://interactjs.io/docs/#ignorable-selectors)中的`ignoreFrom`
393401

394402
* **dragAllowFrom**
395-
403+
396404
* type: `String`
397405
* required: `false`
398406
* default: `null`
@@ -404,7 +412,7 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
404412
请参考 [interact.js docs](http://interactjs.io/docs/#ignorable-selectors)中的`allowFrom`
405413

406414
* **resizeIgnoreFrom**
407-
415+
408416
* type: `String`
409417
* required: `false`
410418
* default: `'a, button'`
@@ -419,7 +427,7 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
419427

420428
每一个栅格元素`grid-item`上都可以添加监听器,用于监听移动和调整大小事件,这样父级Vue对象就可以收到通知。
421429

422-
[示例](https://jbaysolutions.github.io/vue-grid-layout/examples/02-events.html)
430+
[示例](https://jbaysolutions.github.io/vue-grid-layout/examples/02-events.html)
423431

424432
````html
425433

@@ -453,7 +461,7 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
453461
{{item.i}}
454462
</grid-item>
455463
</grid-layout>
456-
````
464+
````
457465

458466
* **layoutCreatedEvent**
459467

@@ -518,12 +526,12 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
518526
* **resizeEvent**
519527

520528
调整大小时的事件
521-
529+
522530
```javascript
523531
resizeEvent: function(i, newH, newW, newHPx, newWPx){
524532
console.log("RESIZE i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
525533
},
526-
```
534+
```
527535

528536
* **movedEvent**
529537

@@ -538,21 +546,21 @@ Also check https://cli.vuejs.org/guide/build-targets.html#library
538546
* **resizedEvent**
539547

540548
调整大小后的事件
541-
549+
542550
```javascript
543551
/**
544-
*
552+
*
545553
* @param i the item id/index
546-
* @param newH new height in grid rows
554+
* @param newH new height in grid rows
547555
* @param newW new width in grid columns
548556
* @param newHPx new height in pixels
549557
* @param newWPx new width in pixels
550-
*
558+
*
551559
*/
552560
resizedEvent: function(i, newH, newW, newHPx, newWPx){
553561
console.log("RESIZED i=" + i + ", H=" + newH + ", W=" + newW + ", H(px)=" + newHPx + ", W(px)=" + newWPx);
554562
},
555-
```
563+
```
556564

557565

558566
## 如何贡献

0 commit comments

Comments
 (0)