Commit afd3509a89a8a8bf6bd6fd1f4d51ee03311cac66
1 parent
3b005863
update Transfer
update Transfer
Showing
3 changed files
with
51 additions
and
2 deletions
Show diff stats
src/components/transfer/search.vue
src/components/transfer/transfer.vue
test/routers/form.vue
1 | 1 | <template> |
2 | - <div style="width: 400px"> | |
2 | + <div style="width: 600px"> | |
3 | 3 | <i-form v-ref:form :model="form" :rules="rules" :label-width="100" label-position="right"> |
4 | 4 | <form-item label="邮箱" prop="mail"> |
5 | 5 | <i-input :value.sync="form.mail" placeholder="请输入邮箱"> |
... | ... | @@ -158,6 +158,13 @@ |
158 | 158 | <form-item label="级联" prop="cascader"> |
159 | 159 | <Cascader :data="data" :value.sync="form.cascader"></Cascader> |
160 | 160 | </form-item> |
161 | + <form-item label="穿梭框" prop="targetKeys1"> | |
162 | + <Transfer | |
163 | + :data="form.transfer" | |
164 | + :target-keys="form.targetKeys1" | |
165 | + :render-format="render1" | |
166 | + @on-change="handleChange1"></Transfer> | |
167 | + </form-item> | |
161 | 168 | <form-item> |
162 | 169 | <i-button type="primary" @click="onSubmit('form')">提交</i-button> |
163 | 170 | </form-item> |
... | ... | @@ -253,7 +260,9 @@ |
253 | 260 | slider: [40, 50], |
254 | 261 | date: '', |
255 | 262 | date2: '', |
256 | - cascader: [] | |
263 | + cascader: [], | |
264 | + transfer: this.getMockData(), | |
265 | + targetKeys1: this.getTargetKeys() | |
257 | 266 | }, |
258 | 267 | rules: { |
259 | 268 | mail: [ |
... | ... | @@ -328,6 +337,11 @@ |
328 | 337 | { |
329 | 338 | type: 'array', required: true |
330 | 339 | } |
340 | + ], | |
341 | + targetKeys1: [ | |
342 | + { | |
343 | + type: 'array', min: 8, max: 10 | |
344 | + } | |
331 | 345 | ] |
332 | 346 | } |
333 | 347 | } |
... | ... | @@ -346,6 +360,32 @@ |
346 | 360 | }, |
347 | 361 | c (s) { |
348 | 362 | console.log(this.form.date) |
363 | + }, | |
364 | + getMockData () { | |
365 | + let mockData = []; | |
366 | + for (let i = 1; i <= 20; i++) { | |
367 | + mockData.push({ | |
368 | + key: i.toString(), | |
369 | + label: '内容' + i, | |
370 | + description: '内容' + i + '的描述信息', | |
371 | + disabled: Math.random() * 3 < 1 | |
372 | + }); | |
373 | + } | |
374 | + return mockData; | |
375 | + }, | |
376 | + getTargetKeys () { | |
377 | + return this.getMockData() | |
378 | + .filter(() => Math.random() * 2 > 1) | |
379 | + .map(item => item.key); | |
380 | + }, | |
381 | + render1 (item) { | |
382 | + return item.label; | |
383 | + }, | |
384 | + handleChange1 (newTargetKeys, direction, moveKeys) { | |
385 | + console.log(newTargetKeys); | |
386 | + console.log(direction); | |
387 | + console.log(moveKeys); | |
388 | + this.form.targetKeys1 = newTargetKeys; | |
349 | 389 | } |
350 | 390 | } |
351 | 391 | }; | ... | ... |