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

View file

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