需求功能前后端代码实现
This commit is contained in:
33
test-ui/src/components/FormItem/option/SimpleOptions.vue
Normal file
33
test-ui/src/components/FormItem/option/SimpleOptions.vue
Normal file
@@ -0,0 +1,33 @@
|
||||
<template>
|
||||
<div class="options">
|
||||
<el-option
|
||||
v-for="(option, i) in options"
|
||||
:key="getKey(option, i)"
|
||||
:label="getLabel(option, i)"
|
||||
:value="getValue(option, i)"
|
||||
:disabled="option.disabled"
|
||||
></el-option>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
export default {
|
||||
name: 'SimpleOptions',
|
||||
props: {
|
||||
options: Array,
|
||||
label: String,
|
||||
value: String,
|
||||
},
|
||||
methods: {
|
||||
getKey(option, i) {
|
||||
return 'option_' + i
|
||||
},
|
||||
getLabel(option) {
|
||||
return this.label ? option[this.label] : option.label
|
||||
},
|
||||
getValue(option) {
|
||||
return this.value ? option[this.value] : option.value
|
||||
},
|
||||
},
|
||||
}
|
||||
</script>
|
||||
Reference in New Issue
Block a user