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