import { defineComponent } from "vue";
import { ElButton } from "element-plus";
import { useRenderIcon } from "/@/components/ReIcon/src/hooks";
import { exportPageContent } from "/@/utils/export";

//execl导出
const Export = defineComponent({
  props: {
    selects: {
      type: Array as PropType<any[]>
    },
    columns: {
      type: Array as PropType<any[]>
    }
  },
  setup(props) {
    return () => (
      <ElButton
        icon={useRenderIcon("excel")}
        size="small"
        onClick={() =>
          exportPageContent({
            type: "front",
            data: props.selects,
            columns: props.columns
          })
        }
      >
        导出
      </ElButton>
    );
  }
});

export default Export;
