8fbc8c71
梁灏
fixed #555
|
1
|
<template>
|
7479854b
梁灏
update Transfer
|
2
|
<Transfer
|
a61acfdc
梁灏
update Transfer i...
|
3
4
5
6
7
8
9
10
11
12
13
|
:data="data3"
:target-keys="targetKeys3"
:list-style="listStyle"
:render-format="render3"
:operations="['To left','To right']"
filterable
@on-change="handleChange3">
<div :style="{float: 'right', margin: '5px'}">
<Button type="ghost" size="small" @click="reloadMockData">Refresh</Button>
</div>
</Transfer>
|
8fbc8c71
梁灏
fixed #555
|
14
15
16
17
18
|
</template>
<script>
export default {
data () {
return {
|
a61acfdc
梁灏
update Transfer i...
|
19
20
21
22
23
24
|
data3: this.getMockData(),
targetKeys3: this.getTargetKeys(),
listStyle: {
width: '250px',
height: '300px'
}
|
8fbc8c71
梁灏
fixed #555
|
25
26
|
}
},
|
8fbc8c71
梁灏
fixed #555
|
27
|
methods: {
|
8fbc8c71
梁灏
fixed #555
|
28
29
30
31
32
|
getMockData () {
let mockData = [];
for (let i = 1; i <= 20; i++) {
mockData.push({
key: i.toString(),
|
a61acfdc
梁灏
update Transfer i...
|
33
34
|
label: 'Content ' + i,
description: 'The desc of content ' + i,
|
8fbc8c71
梁灏
fixed #555
|
35
36
37
38
39
|
disabled: Math.random() * 3 < 1
});
}
return mockData;
},
|
8fbc8c71
梁灏
fixed #555
|
40
41
42
43
44
|
getTargetKeys () {
return this.getMockData()
.filter(() => Math.random() * 2 > 1)
.map(item => item.key);
},
|
a61acfdc
梁灏
update Transfer i...
|
45
46
47
48
49
|
handleChange3 (newTargetKeys) {
this.targetKeys3 = newTargetKeys;
},
render3 (item) {
return item.label + ' - ' + item.description;
|
8fbc8c71
梁灏
fixed #555
|
50
|
},
|
a61acfdc
梁灏
update Transfer i...
|
51
52
53
|
reloadMockData () {
this.data3 = this.getMockData();
this.targetKeys3 = this.getTargetKeys();
|
8fbc8c71
梁灏
fixed #555
|
54
55
56
|
}
}
}
|
7479854b
梁灏
update Transfer
|
57
|
</script>
|