select-stock-status.vue 933 Bytes
<template>
    <Select :value="handleValue" @on-change="updateValue" clearable :disabled="disable" placeholder="请选择">
        <Option :value="item.value" v-for="item in list" :key="item.value">{{item.label}}</Option>
    </Select>
</template>

<script>
export default {
    name: 'select-stock-status',
    props: {
        value: {
            type: String
        },
        disable: {
            type: Boolean
        }
    },
    data() {
        return {
            handleValue: this.value,
            list: [{
                value: 1,
                label: '有库存'
            }, {
                value: 2,
                label: '无库存'
            }]
        };
    },
    methods: {
        updateValue(newValue) {
            this.$emit('input', newValue);
        }
    },
    watch: {
        value(newValue) {
            this.handleValue = newValue;
        }
    }

};
</script>

<style>

</style>