<template>
    <el-select v-model="inner" clearable @change="change" :disabled="disabled">
        <el-option v-for="item in sysCode[type]" :key="item.key" :label="item.label" :value="item.value"/>
    </el-select>
</template>

<script>
export default {
    props: {
        value: {
            type: String, default: ''
        },
        type: {
            type: String, require: true
        },
        disabled: {
            type: Boolean, default: false
        },
    },
    components: {},
    data: () => ({
        inner: '',
    }),
    watch: {
        value(nv){
            this.inner = nv;
        }
    },
    mounted() {
        if (!this.sysCode[this.type]) {
            this.$store.dispatch("base/loadSysCode", this.type)
        }
        this.inner = this.value;
    },
    methods: {
        change(v) {
            this.$emit('input', v);
        }
    }
}
</script>

<style scoped>

</style>