Transfer add new prop reverseOperation

This commit is contained in:
梁灏 2020-04-08 14:54:02 +08:00
parent 69c439d65c
commit 4af3c4737e
2 changed files with 26 additions and 8 deletions

View file

@ -1,11 +1,21 @@
<template>
<div :class="prefixCls + '-operation'">
<i-button type="primary" size="small" :disabled="!rightActive" @click.native="moveToLeft">
<Icon type="ios-arrow-back"></Icon> <span>{{ operations[0] }}</span>
</i-button>
<i-button type="primary" size="small" :disabled="!leftActive" @click.native="moveToRight">
<span>{{ operations[1] }}</span> <Icon type="ios-arrow-forward"></Icon>
</i-button>
<template v-if="reverseOperation">
<i-button type="primary" size="small" :disabled="!leftActive" @click.native="moveToRight">
<span>{{ operations[1] }}</span> <Icon type="ios-arrow-forward"></Icon>
</i-button>
<i-button type="primary" size="small" :disabled="!rightActive" @click.native="moveToLeft">
<Icon type="ios-arrow-back"></Icon> <span>{{ operations[0] }}</span>
</i-button>
</template>
<template v-else>
<i-button type="primary" size="small" :disabled="!rightActive" @click.native="moveToLeft">
<Icon type="ios-arrow-back"></Icon> <span>{{ operations[0] }}</span>
</i-button>
<i-button type="primary" size="small" :disabled="!leftActive" @click.native="moveToRight">
<span>{{ operations[1] }}</span> <Icon type="ios-arrow-forward"></Icon>
</i-button>
</template>
</div>
</template>
<script>
@ -19,7 +29,8 @@
prefixCls: String,
operations: Array,
leftActive: Boolean,
rightActive: Boolean
rightActive: Boolean,
reverseOperation: Boolean
},
methods: {
moveToLeft () {

View file

@ -57,7 +57,8 @@
prefixCls: this.prefixCls,
operations: this.operations,
leftActive: this.leftValidKeysCount > 0,
rightActive: this.rightValidKeysCount > 0
rightActive: this.rightValidKeysCount > 0,
reverseOperation: this.reverseOperation
}
}),
@ -138,6 +139,12 @@
},
notFoundText: {
type: String
},
// 4.2.0
//
reverseOperation: {
type: Boolean,
default: false
}
},
data () {