Commit 37ee15352838f254ba167c130beddcc275f22708
1 parent
77f7bb95
update Transfer
update Transfer
Showing
3 changed files
with
15 additions
and
4 deletions
Show diff stats
src/components/transfer/list.vue
... | ... | @@ -11,13 +11,13 @@ |
11 | 11 | :query.sync="query" |
12 | 12 | :placeholder="filterPlaceholder"></Search> |
13 | 13 | </div> |
14 | - <ul :class="prefixCls + '-content'" v-if="showItems.length"> | |
14 | + <ul :class="prefixCls + '-content'"> | |
15 | 15 | <li |
16 | 16 | v-for="item in showItems | filterBy filterData" |
17 | 17 | :class="[prefixCls + '-content-item', {[prefixCls + '-content-item-disabled']: item.disabled}]" |
18 | 18 | @click.prevent="select(item)"><Checkbox :checked="isCheck(item)" :disabled="item.disabled">{{ showLabel(item) }}</Checkbox></li> |
19 | + <li :class="prefixCls + '-content-not-found'">{{ notFoundText }}</li> | |
19 | 20 | </ul> |
20 | - <div :class="prefixCls + '-body-not-found'" v-else>{{ notFoundText }}</div> | |
21 | 21 | </div> |
22 | 22 | <div :class="prefixCls + '-footer'"> |
23 | 23 | <slot></slot> |
... | ... | @@ -30,7 +30,6 @@ |
30 | 30 | |
31 | 31 | export default { |
32 | 32 | components: { Search, Checkbox }, |
33 | -// filters: { filterData: this.filterData }, | |
34 | 33 | props: { |
35 | 34 | prefixCls: String, |
36 | 35 | data: Array, | ... | ... |
src/styles/components/transfer.less
... | ... | @@ -53,6 +53,15 @@ |
53 | 53 | white-space: nowrap; |
54 | 54 | text-overflow: ellipsis; |
55 | 55 | } |
56 | + | |
57 | + &-not-found{ | |
58 | + display: none; | |
59 | + text-align: center; | |
60 | + color: @btn-disable-color; | |
61 | + } | |
62 | + li&-not-found:only-child{ | |
63 | + display: block; | |
64 | + } | |
56 | 65 | } |
57 | 66 | &-body-with-search &-content{ |
58 | 67 | padding: 0; | ... | ... |
test/routers/transfer.vue
... | ... | @@ -9,7 +9,6 @@ |
9 | 9 | :data="data" |
10 | 10 | filterable |
11 | 11 | :target-keys.sync="targetKeys" |
12 | - :selected-keys="selectedKeys" | |
13 | 12 | :operations="['向左移动','向右移动']" |
14 | 13 | @on-change="change"></Transfer> |
15 | 14 | </div> |
... | ... | @@ -35,6 +34,10 @@ |
35 | 34 | change (newTargetKeys, direction, moveKeys) { |
36 | 35 | // console.log(newTargetKeys) |
37 | 36 | this.targetKeys = newTargetKeys; |
37 | + }, | |
38 | + filterMethod (data, query) { | |
39 | + if (query === '') return true; | |
40 | + return data.label === query; | |
38 | 41 | } |
39 | 42 | } |
40 | 43 | } | ... | ... |