<template>
    <div>
        <div v-if="Object.is(itemType,'BUTTON')" >
        <Button type="primary" long @click="onClick">
            <i v-if="icon" :class="icon"></i>
            <span v-if="showCaption">{{caption ? caption : ''}}</span>
        </Button>
        </div>
        <div v-if="Object.is(itemType,'RAWITEM')">
            <i v-if="icon" :class="icon"></i>
            <span v-if="showCaption" style="padding-right: 10px;">{{caption ? caption : ''}}</span>
            <slot></slot>
        </div>
    </div>
</template>

<script lang="ts">
import { Vue, Component, Prop, Watch } from "vue-property-decorator";

@Component({})
export default class AppPanelButton extends Vue {

    /**
     * 面板成员类型
     *  
     * @type {string}
     * @memberof AppPanelButton
     */
    @Prop() public itemType!: string;

    /**
     * 图标
     *  
     * @type {string}
     * @memberof AppPanelButton
     */
    @Prop() public icon?: string;

    /**
     * 标题
     *  
     * @type {string}
     * @memberof AppPanelButton
     */
    @Prop() public caption?: string;

    /**
     * 显示标题
     *  
     * @type {boolean}
     * @memberof AppPanelButton
     */
    @Prop() public showCaption?: boolean;

    /**
     * 点击按钮
     *
     * @param {*} $event
     * @memberof AppPanelButton
     */
    public onClick($event: any){
        this.$emit('onClick',$event);
    }

}
</script>
<style lang='less'>

</style>