Browse Source

修改select更改值无效问题

pull/7/head
zq 3 weeks ago
parent
commit
eee4554c7c
  1. 20
      src/components/GuipSelect.vue

20
src/components/GuipSelect.vue

@ -9,7 +9,8 @@
<el-select <el-select
:style="{width:width}" :style="{width:width}"
:placeholder="placeholder1" :placeholder="placeholder1"
v-model="value"> @change="handleChange"
v-model="selectedValue">
<el-option <el-option
v-for="item in options" v-for="item in options"
:key="item.value" :key="item.value"
@ -28,19 +29,20 @@
'width','height','label','type','prop','rules','column','addClass','desc'], 'width','height','label','type','prop','rules','column','addClass','desc'],
data() { data() {
return { return {
value: '', selectedValue:'',
style:{}, style:{},
placeholder1:'请选择' placeholder1:'请选择'
} }
}, },
defaultValue(newVal) { watch: {
console.log(newVal,'newVal'); value(newVal) {
this.value = newVal; this.selectedValue = newVal;
}
}, },
mounted(){ mounted(){
// //
if(this.defaultValue != null){ if(this.defaultValue != null){
this.value = this.defaultValue; this.selectedValue = this.defaultValue;
} }
// //
if(this.placeholder){ if(this.placeholder){
@ -58,5 +60,11 @@
}) })
}) })
}, },
methods:{
handleChange(value) {
this.$emit('input', value);
this.$emit('change', value);
},
}
} }
</script> </script>
Loading…
Cancel
Save