From eee4554c7c4ebf46003aabd0aeaecb079ee9399a Mon Sep 17 00:00:00 2001 From: zq <136432190602163.com> Date: Wed, 30 Apr 2025 17:47:34 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9select=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E5=80=BC=E6=97=A0=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/GuipSelect.vue | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/components/GuipSelect.vue b/src/components/GuipSelect.vue index 7bc1d0d..59b658f 100644 --- a/src/components/GuipSelect.vue +++ b/src/components/GuipSelect.vue @@ -9,7 +9,8 @@ <el-select :style="{width:width}" :placeholder="placeholder1" - v-model="value"> + @change="handleChange" + v-model="selectedValue"> <el-option v-for="item in options" :key="item.value" @@ -28,19 +29,20 @@ 'width','height','label','type','prop','rules','column','addClass','desc'], data() { return { - value: '', + selectedValue:'', style:{}, placeholder1:'请选择' } }, - defaultValue(newVal) { - console.log(newVal,'newVal'); - this.value = newVal; + watch: { + value(newVal) { + this.selectedValue = newVal; + } }, mounted(){ // 默认值赋值 if(this.defaultValue != null){ - this.value = this.defaultValue; + this.selectedValue = this.defaultValue; } // 默认提示语 if(this.placeholder){ @@ -58,5 +60,11 @@ }) }) }, + methods:{ + handleChange(value) { + this.$emit('input', value); + this.$emit('change', value); + }, + } } </script> \ No newline at end of file -- 1.8.3.1