update Transfer

update Transfer
This commit is contained in:
梁灏 2016-11-18 12:02:09 +08:00
parent 77f7bb9533
commit 37ee153528
3 changed files with 15 additions and 4 deletions

View file

@ -11,13 +11,13 @@
:query.sync="query" :query.sync="query"
:placeholder="filterPlaceholder"></Search> :placeholder="filterPlaceholder"></Search>
</div> </div>
<ul :class="prefixCls + '-content'" v-if="showItems.length"> <ul :class="prefixCls + '-content'">
<li <li
v-for="item in showItems | filterBy filterData" v-for="item in showItems | filterBy filterData"
:class="[prefixCls + '-content-item', {[prefixCls + '-content-item-disabled']: item.disabled}]" :class="[prefixCls + '-content-item', {[prefixCls + '-content-item-disabled']: item.disabled}]"
@click.prevent="select(item)"><Checkbox :checked="isCheck(item)" :disabled="item.disabled">{{ showLabel(item) }}</Checkbox></li> @click.prevent="select(item)"><Checkbox :checked="isCheck(item)" :disabled="item.disabled">{{ showLabel(item) }}</Checkbox></li>
<li :class="prefixCls + '-content-not-found'">{{ notFoundText }}</li>
</ul> </ul>
<div :class="prefixCls + '-body-not-found'" v-else>{{ notFoundText }}</div>
</div> </div>
<div :class="prefixCls + '-footer'"> <div :class="prefixCls + '-footer'">
<slot></slot> <slot></slot>
@ -30,7 +30,6 @@
export default { export default {
components: { Search, Checkbox }, components: { Search, Checkbox },
// filters: { filterData: this.filterData },
props: { props: {
prefixCls: String, prefixCls: String,
data: Array, data: Array,

View file

@ -53,6 +53,15 @@
white-space: nowrap; white-space: nowrap;
text-overflow: ellipsis; text-overflow: ellipsis;
} }
&-not-found{
display: none;
text-align: center;
color: @btn-disable-color;
}
li&-not-found:only-child{
display: block;
}
} }
&-body-with-search &-content{ &-body-with-search &-content{
padding: 0; padding: 0;

View file

@ -9,7 +9,6 @@
:data="data" :data="data"
filterable filterable
:target-keys.sync="targetKeys" :target-keys.sync="targetKeys"
:selected-keys="selectedKeys"
:operations="['向左移动','向右移动']" :operations="['向左移动','向右移动']"
@on-change="change"></Transfer> @on-change="change"></Transfer>
</div> </div>
@ -35,6 +34,10 @@
change (newTargetKeys, direction, moveKeys) { change (newTargetKeys, direction, moveKeys) {
// console.log(newTargetKeys) // console.log(newTargetKeys)
this.targetKeys = newTargetKeys; this.targetKeys = newTargetKeys;
},
filterMethod (data, query) {
if (query === '') return true;
return data.label === query;
} }
} }
} }