select-stock-status.vue
933 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<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>