<template>
    <div class="ps-page-button" :class="{'is-middle': isMiddle, 'is-square': isSquare}">
        <div class="font">
            <slot></slot>
        </div>
        <div class="buttons">
            <ps-button v-if="config.back" type="info" @click="backCb">{{config.backText || '返回'}}</ps-button>
            <ps-button v-if="config.refuse"  type="refuse" @click="refuseCb">{{config.refuseText || '拒绝'}}</ps-button>
            <ps-button v-if="config.cancel"  type="info" @click="cancelCb">{{config.cancelText || '取消'}}</ps-button>
            <ps-button v-if="config.submit"  type="primary" @click="submitCb">{{config.submitText || '确认'}}</ps-button>
        </div>
    </div>
</template>

<script>
const props = {
    isMiddle: {
        type: Boolean,
        default () {
            return false;
        }
    },
    isSquare: {
        type: Boolean,
        default () {
            return false;
        }
    },
    config: {
        type: Object,
        default () {
            return {};
        }
    }
};
import psButton from '../../../basicsComponent/button';
export default {
    name: 'PsPageButton',
    props,
    components: {
        psButton
    },
    methods: {
        backCb () {
            this.$emit('back', true);
        },
        refuseCb () {
            this.$emit('refuse', true);
        },
        cancelCb () {
            this.$emit('cancel', true);
        },
        submitCb () {
            this.$emit('submit', true);
        }
    }
}
</script>

<style>

</style>