Commit 122e69ee97cb8c68fc6933652a784860c2b5dd30
1 parent
37ee1535
update Transfer
update Transfer
Showing
6 changed files
with
44 additions
and
13 deletions
Show diff stats
src/components/checkbox/checkbox.vue
... | ... | @@ -18,7 +18,7 @@ |
18 | 18 | v-model="checked" |
19 | 19 | @change="change"> |
20 | 20 | </span> |
21 | - <slot v-if="showSlot"><span v-el:slot>{{ value }}</span></slot> | |
21 | + <slot v-if="showSlot"><span v-el:slot style="display:none">{{ value }}</span></slot> | |
22 | 22 | </label> |
23 | 23 | </template> |
24 | 24 | <script> |
... | ... | @@ -78,6 +78,8 @@ |
78 | 78 | this.updateModel(); |
79 | 79 | if (this.$els.slot && this.$els.slot.innerHTML === '') { |
80 | 80 | this.showSlot = false; |
81 | + } else { | |
82 | + this.$els.slot.style.display = 'inline'; | |
81 | 83 | } |
82 | 84 | } |
83 | 85 | }, | ... | ... |
src/components/transfer/list.vue
1 | 1 | <template> |
2 | 2 | <div :class="prefixCls" :style="style"> |
3 | 3 | <div :class="prefixCls + '-header'"> |
4 | - <Checkbox :checked.sync="checkedAll" :disabled="checkedAllDisabled" @on-change="toggleSelectAll">{{ title }}</Checkbox> | |
4 | + <Checkbox :checked.sync="checkedAll" :disabled="checkedAllDisabled" @on-change="toggleSelectAll"></Checkbox> | |
5 | + <span>{{ title }}</span> | |
5 | 6 | <span :class="prefixCls + '-header-count'">{{ count }}</span> |
6 | 7 | </div> |
7 | 8 | <div :class="bodyClasses"> |
... | ... | @@ -15,7 +16,10 @@ |
15 | 16 | <li |
16 | 17 | v-for="item in showItems | filterBy filterData" |
17 | 18 | :class="[prefixCls + '-content-item', {[prefixCls + '-content-item-disabled']: item.disabled}]" |
18 | - @click.prevent="select(item)"><Checkbox :checked="isCheck(item)" :disabled="item.disabled">{{ showLabel(item) }}</Checkbox></li> | |
19 | + @click.prevent="select(item)"> | |
20 | + <Checkbox :checked="isCheck(item)" :disabled="item.disabled"></Checkbox> | |
21 | + <span>{{ showLabel(item) }}</span> | |
22 | + </li> | |
19 | 23 | <li :class="prefixCls + '-content-not-found'">{{ notFoundText }}</li> |
20 | 24 | </ul> |
21 | 25 | </div> |
... | ... | @@ -82,9 +86,7 @@ |
82 | 86 | index > -1 ? this.checkedKeys.splice(index, 1) : this.checkedKeys.push(item.key); |
83 | 87 | }, |
84 | 88 | updateFilteredData () { |
85 | - this.showItems = this.data.map(item => { | |
86 | - return item; | |
87 | - }) | |
89 | + this.showItems = this.data; | |
88 | 90 | }, |
89 | 91 | toggleSelectAll (status) { |
90 | 92 | this.checkedKeys = status ? | ... | ... |
src/styles/components/transfer.less
... | ... | @@ -12,14 +12,14 @@ |
12 | 12 | font-size: @font-size-small; |
13 | 13 | vertical-align: middle; |
14 | 14 | border: 1px solid @border-color-base; |
15 | - border-radius: @border-radius-base; | |
15 | + border-radius: @border-radius-base @border-radius-base 0 0; | |
16 | 16 | position: relative; |
17 | 17 | padding-top: 35px; |
18 | 18 | |
19 | 19 | &-header { |
20 | 20 | padding: 8px 16px; |
21 | 21 | border-radius: @border-radius-base @border-radius-base 0 0; |
22 | - background: #fff; | |
22 | + background: @head-bg; | |
23 | 23 | color: @text-color; |
24 | 24 | border-bottom: 1px solid @border-color-split; |
25 | 25 | overflow: hidden; |
... | ... | @@ -28,6 +28,10 @@ |
28 | 28 | left: 0; |
29 | 29 | width: 100%; |
30 | 30 | |
31 | + & > span{ | |
32 | + padding-left: 4px; | |
33 | + } | |
34 | + | |
31 | 35 | &-count { |
32 | 36 | margin: 0 !important; |
33 | 37 | float: right; |
... | ... | @@ -39,7 +43,7 @@ |
39 | 43 | position: relative; |
40 | 44 | |
41 | 45 | &-with-search{ |
42 | - padding-top: 40px; | |
46 | + padding-top: 34px; | |
43 | 47 | } |
44 | 48 | } |
45 | 49 | |
... | ... | @@ -52,6 +56,10 @@ |
52 | 56 | overflow: hidden; |
53 | 57 | white-space: nowrap; |
54 | 58 | text-overflow: ellipsis; |
59 | + | |
60 | + & > span{ | |
61 | + padding-left: 4px; | |
62 | + } | |
55 | 63 | } |
56 | 64 | |
57 | 65 | &-not-found{ |
... | ... | @@ -64,11 +72,11 @@ |
64 | 72 | } |
65 | 73 | } |
66 | 74 | &-body-with-search &-content{ |
67 | - padding: 0; | |
75 | + padding: 6px 0 0; | |
68 | 76 | } |
69 | 77 | |
70 | 78 | &-body-search-wrapper{ |
71 | - padding: 8px; | |
79 | + padding: 8px 8px 0; | |
72 | 80 | position: absolute; |
73 | 81 | top: 0; |
74 | 82 | left: 0; |
... | ... | @@ -78,6 +86,15 @@ |
78 | 86 | &-search{ |
79 | 87 | position: relative; |
80 | 88 | } |
89 | + | |
90 | + &-footer{ | |
91 | + margin: 0 -1px; | |
92 | + border: 1px solid @border-color-base; | |
93 | + border-top: none; | |
94 | + border-radius: 0 0 @border-radius-base @border-radius-base; | |
95 | + | |
96 | + .clearfix(); | |
97 | + } | |
81 | 98 | } |
82 | 99 | &-operation { |
83 | 100 | display: inline-block; | ... | ... |
src/styles/themes/default/custom.less
test/routers/radio.vue
test/routers/transfer.vue
... | ... | @@ -10,11 +10,16 @@ |
10 | 10 | filterable |
11 | 11 | :target-keys.sync="targetKeys" |
12 | 12 | :operations="['向左移动','向右移动']" |
13 | - @on-change="change"></Transfer> | |
13 | + :filter-method="filterMethod" | |
14 | + @on-change="change"> | |
15 | + <div :style="{float: 'right', margin: '5px'}"> | |
16 | + <i-button type="ghost" size="small" @click="getMock">刷新</i-button> | |
17 | + </div> | |
18 | + </Transfer> | |
14 | 19 | </div> |
15 | 20 | </template> |
16 | 21 | <script> |
17 | - import { Transfer } from 'iview'; | |
22 | + import { Transfer, iButton } from 'iview'; | |
18 | 23 | |
19 | 24 | export default { |
20 | 25 | props: { |
... | ... | @@ -38,6 +43,9 @@ |
38 | 43 | filterMethod (data, query) { |
39 | 44 | if (query === '') return true; |
40 | 45 | return data.label === query; |
46 | + }, | |
47 | + getMock () { | |
48 | + | |
41 | 49 | } |
42 | 50 | } |
43 | 51 | } | ... | ... |