update Transfer icons

This commit is contained in:
梁灏 2018-06-26 09:43:26 +08:00
parent 99f6640559
commit a61acfdcb7
4 changed files with 38 additions and 19 deletions

View file

@ -1,16 +1,27 @@
<template> <template>
<Transfer <Transfer
:data="data1" :data="data3"
:target-keys="targetKeys1" :target-keys="targetKeys3"
:render-format="render1" :list-style="listStyle"
@on-change="handleChange1"></Transfer> :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>
</template> </template>
<script> <script>
export default { export default {
data () { data () {
return { return {
data1: this.getMockData(), data3: this.getMockData(),
targetKeys1: this.getTargetKeys() targetKeys3: this.getTargetKeys(),
listStyle: {
width: '250px',
height: '300px'
}
} }
}, },
methods: { methods: {
@ -19,8 +30,8 @@
for (let i = 1; i <= 20; i++) { for (let i = 1; i <= 20; i++) {
mockData.push({ mockData.push({
key: i.toString(), key: i.toString(),
label: '内容' + i, label: 'Content ' + i,
description: '内容' + i + '的描述信息', description: 'The desc of content ' + i,
disabled: Math.random() * 3 < 1 disabled: Math.random() * 3 < 1
}); });
} }
@ -31,14 +42,15 @@
.filter(() => Math.random() * 2 > 1) .filter(() => Math.random() * 2 > 1)
.map(item => item.key); .map(item => item.key);
}, },
render1 (item) { handleChange3 (newTargetKeys) {
return item.label; this.targetKeys3 = newTargetKeys;
}, },
handleChange1 (newTargetKeys, direction, moveKeys) { render3 (item) {
console.log(newTargetKeys); return item.label + ' - ' + item.description;
console.log(direction); },
console.log(moveKeys); reloadMockData () {
this.targetKeys1 = newTargetKeys; this.data3 = this.getMockData();
this.targetKeys3 = this.getTargetKeys();
} }
} }
} }

View file

@ -1,10 +1,10 @@
<template> <template>
<div :class="prefixCls + '-operation'"> <div :class="prefixCls + '-operation'">
<i-button type="primary" size="small" :disabled="!rightActive" @click.native="moveToLeft"> <i-button type="primary" size="small" :disabled="!rightActive" @click.native="moveToLeft">
<Icon type="ios-arrow-left"></Icon> {{ operations[0] }} <Icon type="ios-arrow-back"></Icon> <span>{{ operations[0] }}</span>
</i-button> </i-button>
<i-button type="primary" size="small" :disabled="!leftActive" @click.native="moveToRight"> <i-button type="primary" size="small" :disabled="!leftActive" @click.native="moveToRight">
{{ operations[1] }} <Icon type="ios-arrow-right"></Icon> <span>{{ operations[1] }}</span> <Icon type="ios-arrow-forward"></Icon>
</i-button> </i-button>
</div> </div>
</template> </template>

View file

@ -34,7 +34,7 @@
}, },
computed: { computed: {
icon () { icon () {
return this.query === '' ? 'ios-search' : 'ios-close'; return this.query === '' ? 'ios-search' : 'ios-close-circle';
} }
}, },
methods: { methods: {

View file

@ -115,7 +115,7 @@
} }
&-operation { &-operation {
display: inline-block; display: inline-block;
overflow: hidden; //overflow: hidden;
margin: 0 16px; margin: 0 16px;
vertical-align: middle; vertical-align: middle;
@ -127,6 +127,13 @@
margin-bottom: 12px; margin-bottom: 12px;
} }
} }
.@{btn-prefix-cls}{
span {
i, span{
vertical-align: middle;
}
}
}
} }
} }
.select-item(@transfer-prefix-cls, @transfer-item-prefix-cls); .select-item(@transfer-prefix-cls, @transfer-item-prefix-cls);