<template>
    <b-row align-v="center" class="mb-4">
        <b-col>
            <h1>
                {{title ? title : $route.meta.title}}
            </h1>
            <div v-if="!!$slots.default">
                <slot></slot>
            </div>
        </b-col>
        <b-col cols="auto" class="d-print-none">
            <fup-button variant="light" v-if="$listeners['go-back']" @click="back">
                <fup-icon class="mr-2" weight="r" name="long-arrow-left"/>
                {{backButton ? backButton : 'Назад'}}
            </fup-button>
            <slot name="buttons"></slot>
        </b-col>
    </b-row>
</template>

<script>
    export default {
        name: "PageHeading",
        props: {
            backButton: null,
            title: null,
        },
        methods: {
            back(){
                this.$emit('go-back');
            }
        }
    }
</script>