<template>
<el-select v-model="valueIds" clearable placeholder="请选择电量">
<el-option v-for="(item,index) in options" :key="index" :label="item.description" :value="Number(item.value)" />
</el-select>
</template>
<script>
import api from '@/api/tag'
export default {
name: 'ElectricitySelect',
props: {
value: {
required: false,
type: [String, Number],
default: ''
}
},
data() {
return {
options: []
}
},
computed: {
valueIds: {
get() {
return this.value
},
set(val) {
this.$emit('input', val)
}
}
},
created() {
this.getList()
},
methods: {
getList() {
api.getElectricity().then((response) => {
this.options = response.data
})
}
}
}
</script>
VUE下拉组件
最新推荐文章于 2024-06-12 14:47:27 发布