修改select更改值无效问题 #7

Merged
zhangqi merged 1 commits from zq-popup into master 3 weeks ago
  1. 20
      src/components/GuipSelect.vue

20
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>
Loading…
Cancel
Save