<script>
import {getCurrentInstance, watch} from 'vue';
import IeFormPickerSingle from "@/pagesOther/pages/ie/components/picker/ie-form-picker-single.vue";
import {useInjectMajorTreeService} from "@/pagesOther/pages/ie/hooks/useMajorTreeInjection";

export default {
    /* major category: 一级分类 */
    name: "major-category-picker",
    extends: IeFormPickerSingle,
    props: {
        label: {
            type: String,
            default: '专业种类'
        },
        placeholder: {
            type: String,
            default: '请选择专业种类'
        }
    },
    setup(props) {
        const {majorTree} = useInjectMajorTreeService()
        const instance = getCurrentInstance()
        watch(majorTree, tree => {
            instance.proxy.columns = tree.map(m => ({text: m.name, value: m.code}))
        })
    }
}
</script>

<style scoped>

</style>