<template>
    <el-dropdown
        @command="handleClick"
        :id="id"
        v-bind="$attrs"
    >
        <slot></slot>
        <el-dropdown-menu slot="dropdown">
            <el-dropdown-item
                :command="item"
                v-for="(item, index) in dataSource"
                :key="index"
            >{{item.desc}}</el-dropdown-item>
        </el-dropdown-menu>
    </el-dropdown>
</template>

<script>
export default {
    name: "PsDropdown",
    props: {
        dataSource: {
            type: Array,
            default: () => [],
        },
        id: { type: String, default: "" },
    },
    data() {
        return {
            isLoading: false,
        };
    },
    created() {},
    mounted() {},
    methods: {
        handleClick(item) {
            this.$emit("change", item);
        },
    },
};
</script>

<style></style>
