bklLiudl
2024-05-25 484e5129e4c9a671c5660a556a24bd306f1fdd9b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
<template>
    <div :class="prefixCls + '-operation'">
        <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>
    import iButton from '../button/button.vue';
    import Icon from '../icon/icon.vue';
 
    export default {
        name: 'Operation',
        components: { iButton, Icon },
        props: {
            prefixCls: String,
            operations: Array,
            leftActive: Boolean,
            rightActive: Boolean,
            reverseOperation: Boolean
        },
        methods: {
            moveToLeft () {
                this.$parent.moveTo('left');
            },
            moveToRight () {
                this.$parent.moveTo('right');
            }
        }
    };
</script>