<template>
  <div id="c-button">
    <el-button type="primary" @click="toAdd()" v-if="isAdd">新增</el-button>
    <el-button type="warning" v-if="isEdit">修改</el-button>
    <el-button type="danger" v-if="isDel">删除</el-button>
    <el-button type="warning" @click="toExport()" v-if="isExport">导出</el-button>
    <slot name="custom"></slot>
  </div>
</template>
<script setup lang="ts">
import { toRefs } from 'vue';
const props = defineProps({
  isAdd: { type: Boolean, default: () => true },
  isEdit: { type: Boolean, default: () => false },
  isDel: { type: Boolean, default: () => false },
  isExport: { type: Boolean, default: () => false }
});
const { isAdd } = toRefs(props);
const emit = defineEmits(['toAdd', 'toExport']);
const toAdd = () => {
  emit('toAdd');
};
const toExport = () => {
  emit('toExport');
};
</script>
