From 0796eebe3520fafb0ac5d36ee584af81506d7e9c Mon Sep 17 00:00:00 2001 From: riku <risaku@163.com> Date: 星期六, 20 九月 2025 14:05:52 +0800 Subject: [PATCH] 2025.9.20 数据产品(待完成) --- src/components/search-option/FYOptionUserType.vue | 48 +++++++++++++++++------------------------------- 1 files changed, 17 insertions(+), 31 deletions(-) diff --git a/src/components/search-option/FYOptionUserType.vue b/src/components/search-option/FYOptionUserType.vue index 164c672..050f772 100644 --- a/src/components/search-option/FYOptionUserType.vue +++ b/src/components/search-option/FYOptionUserType.vue @@ -1,16 +1,12 @@ <template> - <el-form-item label="鐢ㄦ埛绫诲瀷"> + <el-form-item label="鐢ㄦ埛绫诲瀷" :prop="prop"> <el-select - v-model="selectedOptions" + :model-value="value" + @change="handleChange" placeholder="鐢ㄦ埛绫诲瀷" style="width: 150px" > - <el-option - v-for="s in userTypes" - :key="s.value" - :label="s.label" - :value="s" - /> + <el-option v-for="s in userTypes" :key="s.value" :label="s.label" :value="s" /> </el-select> </el-form-item> </template> @@ -23,45 +19,35 @@ // 鏄惁鍦ㄩ閫夐」澶勬坊鍔犫�滃叏閮ㄢ�濋�夐」 allOption: { type: Boolean, - default: true, + default: true }, // 杩斿洖缁撴灉 value: Object, // 鏄惁榛樿杩斿洖鍒濆閫夐」 initValue: { type: Boolean, - default: true, + default: true }, + prop: { + type: String, + default: '_usertype' + } }, emits: ['update:value'], data() { return { - userTypes: enumUser(this.allOption), - selectedOptions: {}, + userTypes: enumUser(this.allOption) }; }, - watch: { - selectedOptions: { - handler(nVal, oVal) { - if (nVal != oVal) { - this.$emit('update:value', nVal); - } - }, - deep: true, - }, - value: { - handler(nVal, oVal) { - if (nVal != oVal) { - this.selectedOptions = nVal; - } - }, - deep: true, - }, + methods: { + handleChange(value) { + this.$emit('update:value', value); + } }, mounted() { if (this.initValue) { - this.selectedOptions = this.userTypes[0]; + this.handleChange(this.userTypes[0]); } - }, + } }; </script> -- Gitblit v1.9.3