修复单选组件

This commit is contained in:
2023-02-10 23:36:55 +08:00
parent 5ad8759685
commit 4fed39fe4c

View File

@@ -1,7 +1,7 @@
<template> <template>
<div class="KuSelect"> <div class="KuSelect">
<el-select clearable :modelValue="modelValue" :filterable="isAction" v-bind="$attrs" <el-select clearable :modelValue="modelValue" :filterable="isAction" v-bind="$attrs"
@change="v=>$emit('update:modelValue',v)"> @change="v=>$emit('update:modelValue',v)" placeholder="请选择">
<template v-if="isAction"> <template v-if="isAction">
<el-option v-for="op in actionOps" :key="op.id" :label="op[actionProp.label]" :value="op[actionProp.value]"/> <el-option v-for="op in actionOps" :key="op.id" :label="op[actionProp.label]" :value="op[actionProp.value]"/>
</template> </template>
@@ -23,8 +23,10 @@ export default {
} }
}, },
modelValue(v) { modelValue(v) {
this.$emit("select", this.isAction ? this.options.find(e => e[this.actionProp.value] == v) : this.$emit("select", this.isAction ? this.options.find(e => e[this.actionProp.value] == v) : {
this.selectList.find(e => e.dictValue == v)) name: this.ops[v],
value: v
})
} }
}, },
props: { props: {
@@ -35,7 +37,6 @@ export default {
prop: {default: () => ({})}, prop: {default: () => ({})},
dict: String dict: String
}, },
emits: ['update:modelValue'],
data() { data() {
return { return {
options: [], options: [],