8fbc8c71
梁灏
fixed #555
|
1
|
<template>
|
7479854b
梁灏
update Transfer
|
2
3
4
5
6
|
<Transfer
:data="data1"
:target-keys="targetKeys1"
:render-format="render1"
@on-change="handleChange1"></Transfer>
|
8fbc8c71
梁灏
fixed #555
|
7
8
9
10
11
|
</template>
<script>
export default {
data () {
return {
|
7479854b
梁灏
update Transfer
|
12
|
data1: this.getMockData(),
|
8fbc8c71
梁灏
fixed #555
|
13
14
15
|
targetKeys1: this.getTargetKeys()
}
},
|
8fbc8c71
梁灏
fixed #555
|
16
|
methods: {
|
8fbc8c71
梁灏
fixed #555
|
17
18
19
20
21
22
23
24
25
26
27
28
|
getMockData () {
let mockData = [];
for (let i = 1; i <= 20; i++) {
mockData.push({
key: i.toString(),
label: '内容' + i,
description: '内容' + i + '的描述信息',
disabled: Math.random() * 3 < 1
});
}
return mockData;
},
|
8fbc8c71
梁灏
fixed #555
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
getTargetKeys () {
return this.getMockData()
.filter(() => Math.random() * 2 > 1)
.map(item => item.key);
},
render1 (item) {
return item.label;
},
handleChange1 (newTargetKeys, direction, moveKeys) {
console.log(newTargetKeys);
console.log(direction);
console.log(moveKeys);
this.targetKeys1 = newTargetKeys;
}
}
}
|
7479854b
梁灏
update Transfer
|
45
|
</script>
|