Commit 37ee15352838f254ba167c130beddcc275f22708

Authored by 梁灏
1 parent 77f7bb95

update Transfer

update Transfer
src/components/transfer/list.vue
@@ -11,13 +11,13 @@ @@ -11,13 +11,13 @@
11 :query.sync="query" 11 :query.sync="query"
12 :placeholder="filterPlaceholder"></Search> 12 :placeholder="filterPlaceholder"></Search>
13 </div> 13 </div>
14 - <ul :class="prefixCls + '-content'" v-if="showItems.length"> 14 + <ul :class="prefixCls + '-content'">
15 <li 15 <li
16 v-for="item in showItems | filterBy filterData" 16 v-for="item in showItems | filterBy filterData"
17 :class="[prefixCls + '-content-item', {[prefixCls + '-content-item-disabled']: item.disabled}]" 17 :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> 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 </ul> 20 </ul>
20 - <div :class="prefixCls + '-body-not-found'" v-else>{{ notFoundText }}</div>  
21 </div> 21 </div>
22 <div :class="prefixCls + '-footer'"> 22 <div :class="prefixCls + '-footer'">
23 <slot></slot> 23 <slot></slot>
@@ -30,7 +30,6 @@ @@ -30,7 +30,6 @@
30 30
31 export default { 31 export default {
32 components: { Search, Checkbox }, 32 components: { Search, Checkbox },
33 -// filters: { filterData: this.filterData },  
34 props: { 33 props: {
35 prefixCls: String, 34 prefixCls: String,
36 data: Array, 35 data: Array,
src/styles/components/transfer.less
@@ -53,6 +53,15 @@ @@ -53,6 +53,15 @@
53 white-space: nowrap; 53 white-space: nowrap;
54 text-overflow: ellipsis; 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 &-body-with-search &-content{ 66 &-body-with-search &-content{
58 padding: 0; 67 padding: 0;
test/routers/transfer.vue
@@ -9,7 +9,6 @@ @@ -9,7 +9,6 @@
9 :data="data" 9 :data="data"
10 filterable 10 filterable
11 :target-keys.sync="targetKeys" 11 :target-keys.sync="targetKeys"
12 - :selected-keys="selectedKeys"  
13 :operations="['向左移动','向右移动']" 12 :operations="['向左移动','向右移动']"
14 @on-change="change"></Transfer> 13 @on-change="change"></Transfer>
15 </div> 14 </div>
@@ -35,6 +34,10 @@ @@ -35,6 +34,10 @@
35 change (newTargetKeys, direction, moveKeys) { 34 change (newTargetKeys, direction, moveKeys) {
36 // console.log(newTargetKeys) 35 // console.log(newTargetKeys)
37 this.targetKeys = newTargetKeys; 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 }