<template>
    <div :class="actionClass" :ref="'actionBtns' + params.rowIndex">
        <Button type="primary" v-if="parent.isEditBtn" size="small" @click="onEditBtn">
            <i class="icon iconfont iconbianji"></i
            ><span class="font">编辑</span></Button
        >
        <Button
            type="error"
            v-if="parent.isDeleteBtn"
            size="small"
            @click="onDeleteBtn"
        >
            <i class="icon iconfont iconshanchu"></i
            ><span class="font">删除</span></Button
        >
        <span>
            <Dropdown
                class="toolbar-down-button drop-font-icon"
                placement="left-start"
                trigger="click"
                v-if="showFlag[params.rowIndex]"
            >
                <span class="font">更多</span>
                <Icon type="ios-arrow-down" />
                <Dropdown-menu slot="list" :ref="'dropMenu' + params.rowIndex">
                </Dropdown-menu>
            </Dropdown>
            <slot></slot>
        </span>
    </div>
</template>
<script>
    import Emitter from '@/mixins/emitter.js';
    export default {
        data () {
            return {
                parent: null,
                parentName: 'bingo-advance-table',
                showFlag: []
            };
        },
        mixins: [Emitter],
        created () {
            this.parent = this.getParent(this.parentName);
        },
        mounted () {
        },
        computed: {
            actionClass () {
                return 'action-' + this.parent.showBtnType;
            }
        },
        methods: {
            // 编辑
            onEditBtn () {
                this.dispatch(this.parentName, 'on-edit-btn-s', this.params.data);
            },
            // 删除
            onDeleteBtn () {
                this.dispatch(this.parentName, 'on-delete-btn-s', this.params.data);
            }
        }
    };
</script>
