select-season.vue 1.22 KB
<template>
    <Select :value="handleValue" @on-change="updateValue" :disabled="disable" placeholder="请选择" style="width: 400px;">
        <Option :value="season.id" v-for="season in seasonList" :key="season.id">{{season.label}}</Option>
    </Select>
</template>

<script>
export default {
    name: 'select-season',
    props: {
        value: {
            type: String
        },
        disable: {
            type: Boolean
        }
    },
    data() {
        return {
            handleValue: this.value,
            seasonList: [{
                id: '1',
                label: '春季'
            }, {
                id: '2',
                label: '夏季'
            }, {
                id: '3',
                label: '秋季'
            }, {
                id: '4',
                label: '冬季'
            }, {
                id: '5',
                label: '春夏季'
            }, {
                id: '6',
                label: '秋冬季'
            }]
        };
    },
    methods: {
        updateValue(newValue) {
            this.$emit('input', newValue);
        }
    },
    watch: {
        value(newValue) {
            this.handleValue = newValue;
        }
    }

};
</script>

<style>

</style>