de/frontend/src/components/widget/DeWidget/DeSelect.vue
2021-04-09 11:58:03 +08:00

47 lines
782 B
Vue

<template>
<el-select v-if="options!== null && options.attrs!==null" v-model="options.value" :placeholder="options.attrs.placeholder" @change="changeValue">
<el-option
v-for="item in options.attrs.datas"
:key="item[options.attrs.key]"
:label="item[options.attrs.label]"
:value="item[options.attrs.value]"
/>
</el-select>
</template>
<script>
export default {
props: {
element: {
type: Object,
default: null
}
},
data() {
return {
options: null
}
},
created() {
this.options = this.element.options
},
mounted() {
this.$nextTick(() => {
})
},
methods: {
changeValue(value) {
this.$emit('value-change', value)
}
}
}
</script>
<style lang="scss" scoped>
</style>