3
3
4
4
<p align =" center " >
5
5
6
- [ ![ Latest Version on NPM] ( https://img.shields.io/npm/v/vue-drag-resize.svg?style=flat-square )] ( https://npmjs.com/package/vue-drag-resize )
7
- [ ![ Software License] ( https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square )] ( LICENSE.md )
8
- [ ![ npm] ( https://img.shields.io/npm/dt/vue-drag-resize.svg?style=flat-square )] ( https://www.npmjs.com/package/vue-drag-resize )
6
+ [ ![ Latest Version on NPM] ( https://img.shields.io/npm/v/vue-drag-resize.svg?style=flat-square )] ( https://npmjs.com/package/vue-drag-resize )
7
+ [ ![ Software License] ( https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square )] ( LICENSE.md )
8
+ [ ![ npm] ( https://img.shields.io/npm/dt/vue-drag-resize.svg?style=flat-square )] ( https://www.npmjs.com/package/vue-drag-resize )
9
9
</p >
10
10
11
11
<p align =" center " >
31
31
32
32
### Features
33
33
34
- * A lightweight, no-dependency
34
+ * A lightweight, no-dependency
35
35
* All props are reactive
36
36
* Support touch events
37
37
* Snap element to custom grid
43
43
44
44
## Install and basic usage
45
45
46
- For Vue2:
47
46
``` bash
48
47
$ npm i -s vue-drag-resize
49
48
```
50
- For Vue3:
51
- ``` bash
52
- $ npm i -s vue-drag-resize@next
53
- ```
49
+
54
50
55
51
Register the component:
56
52
@@ -112,7 +108,8 @@ Type: `Boolean`<br>
112
108
Required: ` false ` <br >
113
109
Default: ` false `
114
110
115
- Determines whether the component should be active.
111
+ Determines whether the component should be active.
112
+
116
113
确定组件是否应处于活动状态。
117
114
118
115
``` html
@@ -124,10 +121,10 @@ Type: `Boolean`<br>
124
121
Required: ` false ` <br >
125
122
Default: ` false `
126
123
127
- Disable behavior of the component by clicking on it and clicking outside the component's area (isActive: true / false).
124
+ Disable behavior of the component by clicking on it and clicking outside the component's area (isActive: true / false).< br >
128
125
If the prop is enabled, the component is oriented only to the specified.
129
126
130
- 通过单击组件并单击组件区域外部来禁用组件的行为(isActive:true / false)。
127
+ 通过单击组件并单击组件区域外部来禁用组件的行为(isActive:true / false)。< br >
131
128
如果启用了prop,则组件仅面向指定的。
132
129
133
130
``` html
@@ -139,9 +136,10 @@ Type: `Number`<br>
139
136
Required: ` false ` <br >
140
137
Default: ` 0 `
141
138
142
- Define the initial width of the parent element. If not specified it calculated automatically.
139
+ Define the initial width of the parent element. If not specified it calculated automatically.< br >
143
140
With this parameter, you can set the bounding area for the component, and also it is used when resizing in real time.
144
- 定义父元素的初始宽度。 如果未指定,则自动计算。
141
+
142
+ 定义父元素的初始宽度。 如果未指定,则自动计算。<br >
145
143
使用此参数,您可以设置组件的边界区域,并在实时调整大小时使用它。
146
144
``` html
147
145
<vue-drag-resize :parentW =" 2000" >
@@ -152,8 +150,9 @@ Type: `Number`<br>
152
150
Required: ` false ` <br >
153
151
Default: ` 0 `
154
152
155
- Define the initial height of the parent element. If not specified it calculated automatically.
153
+ Define the initial height of the parent element. If not specified it calculated automatically.< br >
156
154
With this parameter, you can set the bounding area for the component, and also it is used when resizing in real time.
155
+
157
156
定义父元素的初始高度。 如果未指定,则自动计算。
158
157
使用此参数,您可以设置组件的边界区域,并在实时调整大小时使用它。
159
158
@@ -166,9 +165,10 @@ Type: `Number`<br>
166
165
Required: ` false ` <br >
167
166
Default: ` 1 `
168
167
169
- Define the initial horizontal scale or the parent element. Same value in parent's transform: scale() css definition.
168
+ Define the initial horizontal scale or the parent element. Same value in parent's transform: scale() css definition.< br >
170
169
The drag/resize and the sticks' sizes will computed with this value.
171
- 定义初始水平比例或父元素。父级的transform: scale ()css定义中的值相同。
170
+
171
+ 定义初始水平比例或父元素。父级的transform: scale ()css定义中的值相同。<br >
172
172
拖动/调整大小和杆的大小将使用该值计算。
173
173
``` html
174
174
<vue-drag-resize :parentScaleX =" 0.5" >
@@ -179,10 +179,10 @@ Type: `Number`<br>
179
179
Required: ` false ` <br >
180
180
Default: ` 1 `
181
181
182
- Define the initial vertical scale or the parent element. Same value in parent's transform: scale() css definition.
182
+ Define the initial vertical scale or the parent element. Same value in parent's transform: scale() css definition.< br >
183
183
The drag/resize and the sticks' sizes will computed with this value.
184
- 定义初始垂直比例或父元素。父级的transform: scale ()css定义中的值相同。
185
184
185
+ 定义初始垂直比例或父元素。父级的transform: scale ()css定义中的值相同。<br >
186
186
拖动/调整大小和杆的大小将使用该值计算。
187
187
188
188
``` html
@@ -195,6 +195,7 @@ Required: `false`<br>
195
195
Default: ` true `
196
196
197
197
Determines whether the component should draggable.
198
+
198
199
确定组件是否应可拖动。
199
200
200
201
@@ -208,6 +209,7 @@ Required: `false`<br>
208
209
Default: ` true `
209
210
210
211
Determines whether the component should resize.
212
+
211
213
确定组件是否应调整大小。
212
214
213
215
@@ -220,6 +222,7 @@ Required: `false`<br>
220
222
Default: ` false `
221
223
222
224
Limits the scope of the component's change to its parent size.
225
+
223
226
将组件更改的范围限制为其父大小。
224
227
225
228
@@ -259,13 +262,14 @@ Define the grid step size for the vertical axis. Both sides of the component (to
259
262
``` html
260
263
<vue-drag-resize :snapToGrid =" true" :gridY =" 20" >
261
264
```
262
-
265
+
263
266
#### aspectRatio
264
267
Type: ` Boolean ` <br >
265
268
Required: ` false ` <br >
266
269
Default: ` false `
267
270
268
271
Determines whether the component should retain its proportions.
272
+
269
273
确定组件是否应保持其比例。
270
274
271
275
@@ -274,11 +278,14 @@ Determines whether the component should retain its proportions.
274
278
```
275
279
276
280
#### w
277
- Type: ` Number ` <br >
281
+ Type: ` Number|String ` <br >
278
282
Required: ` false ` <br >
279
283
Default: ` 200 `
280
284
281
- Define the initial width of the component.
285
+ Define the initial width of the component.<br >
286
+ The value can either be a number >= 0 or the string 'auto'. <br >
287
+ If set to 'auto', the initial width value will be equal to the width of the content within the component.
288
+
282
289
定义组件的初始宽度。
283
290
284
291
@@ -287,11 +294,14 @@ Define the initial width of the component.
287
294
```
288
295
289
296
#### h
290
- Type: ` Number ` <br >
297
+ Type: ` Number|String ` <br >
291
298
Required: ` false ` <br >
292
299
Default: ` 200 `
293
300
294
- Define the initial height of the component.
301
+ Define the initial height of the component.<br >
302
+ The value can either be a number >= 0 or the string 'auto'. <br >
303
+ If set to 'auto', the initial height value will be equal to the height of the content within the component.
304
+
295
305
定义组件的初始高度。
296
306
297
307
@@ -306,6 +316,7 @@ Required: `false`<br>
306
316
Default: ` 50 `
307
317
308
318
Define the minimal width of the component.
319
+
309
320
定义组件的初始宽度。
310
321
311
322
@@ -320,6 +331,7 @@ Required: `false`<br>
320
331
Default: ` 50 `
321
332
322
333
Define the minimal height of the component.
334
+
323
335
定义组件的最小高度。
324
336
325
337
@@ -333,6 +345,7 @@ Required: `false`<br>
333
345
Default: ` 0 `
334
346
335
347
Define the initial x position of the component.
348
+
336
349
定义组件的初始X位置。
337
350
338
351
@@ -346,6 +359,7 @@ Required: `false`<br>
346
359
Default: ` 0 `
347
360
348
361
Define the initial y position of the component.
362
+
349
363
定义组件的初始Y位置。
350
364
351
365
@@ -359,6 +373,7 @@ Required: `false`<br>
359
373
Default: ` auto `
360
374
361
375
Define the zIndex of the component.
376
+
362
377
定义组件的zindex(层级)。
363
378
364
379
``` html
@@ -382,6 +397,7 @@ Required: `false`<br>
382
397
Default: ` ['tl', 'tm', 'tr', 'mr', 'br', 'bm', 'bl', 'ml'] `
383
398
384
399
Define the array of handles to restrict the element resizing:
400
+
385
401
定义句柄数组以限制元素大小调整:
386
402
387
403
* ` tl ` - Top left
@@ -403,6 +419,7 @@ Required: `false`<br>
403
419
Default: ` both `
404
420
405
421
Define the axis on which the element is draggable. Available values are ` x ` , ` y ` , ` both ` or ` none ` .
422
+
406
423
定义元素可拖动的轴。 可用值为` x ` ,` y ` ,` both ` 或` none ` 。
407
424
408
425
``` html
@@ -414,6 +431,7 @@ Type: `String`<br>
414
431
Required: ` false `
415
432
416
433
Defines the selector that should be used to drag the component.
434
+
417
435
定义应该用于拖动组件的选择器。
418
436
419
437
``` html
@@ -425,6 +443,7 @@ Type: `String`<br>
425
443
Required: ` false `
426
444
427
445
Defines a selector that should be used to prevent drag initialization.
446
+
428
447
定义应该用于防止拖动初始化的选择器。
429
448
430
449
``` html
@@ -454,6 +473,7 @@ Required: `false`<br>
454
473
Parameters: ` Original event handler `
455
474
456
475
Called whenever the component gets clicked.
476
+
457
477
单击组件时调用。
458
478
459
479
``` html
@@ -466,6 +486,7 @@ Required: `false`<br>
466
486
Parameters: ` - `
467
487
468
488
Called whenever the component gets clicked, in order to show handles.
489
+
469
490
单击组件时调用,以显示句柄。
470
491
471
492
``` html
@@ -478,6 +499,7 @@ Required: `false`<br>
478
499
Parameters: ` - `
479
500
480
501
Called whenever the user clicks anywhere outside the component, in order to deactivate it.
502
+
481
503
每当用户单击组件外部的任何位置时调用,以便将其停用。
482
504
483
505
@@ -500,6 +522,7 @@ Parameters: `object`
500
522
```
501
523
502
524
Called whenever the component gets resized.
525
+
503
526
每当组件调整大小时调用。
504
527
505
528
@@ -521,6 +544,7 @@ Parameters: `object`
521
544
```
522
545
523
546
Called whenever the component stops getting resized.
547
+
524
548
每当组件停止调整大小时调用。
525
549
526
550
@@ -542,6 +566,7 @@ Parameters: `object`
542
566
```
543
567
544
568
Called whenever the component gets dragged.
569
+
545
570
每当拖动组件时调用。
546
571
547
572
@@ -564,6 +589,7 @@ Parameters: `object`
564
589
565
590
566
591
Called whenever the component stops getting dragged.
592
+
567
593
每当组件停止拖动时调用。
568
594
569
595
@@ -586,4 +612,4 @@ npm run build
586
612
587
613
## License
588
614
589
- [ MIT license] ( LICENSE )
615
+ [ MIT license] ( LICENSE )
0 commit comments