Skip to content

Commit

Permalink
select修复
Browse files Browse the repository at this point in the history
  • Loading branch information
yuri authored and yuri committed Mar 14, 2017
1 parent 17068cc commit 7ec1363
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
29 changes: 11 additions & 18 deletions vb/components/select/select.vue
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@
},
watch: {
value(val){
if(!this.search){
if(this.search){
if(this.multiple && !val.length){
this.labels = [];
}else if(!this.multiple && !val){
this.labels = '';
}
}else{
this.labels = this.multiple?[]:'';
this.initVal();
}
Expand Down Expand Up @@ -215,23 +221,10 @@
handler(val){
this.ori_options = JSON.parse(JSON.stringify(val));
this.mapOptions(([type, path, item])=> {
let selected = false;
if(this.multiple && this.value.includes(item[this.key])){
selected = true;
}else if(!this.multiple && this.value === item[this.key]){
selected = true;
}
if(type == 'item'){
this.$set(`ori_options[${path}].selected`, selected);
this.$set(`ori_options[${path}].show`, true);
}else{
this.$set(`ori_options[${path[0]}].data[${path[1]}].selected`, selected);
this.$set(`ori_options[${path[0]}].data[${path[1]}].show`, true);
}
},(i,group)=> {
this.$set(`ori_options[${i}].show`, true);
})
if(!this.search){
this.labels = this.multiple?[]:'';
}
this.initVal();
},
deep: true
}
Expand Down
2 changes: 1 addition & 1 deletion vb/style/components/multiselect.less
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ fieldset[disabled] .multiselect {
font-style: initial;
width: 22px;
text-align: center;
line-height: 22px;
line-height: 18px;
transition: all 0.2s ease;
border-radius: 5px;
}
Expand Down

0 comments on commit 7ec1363

Please sign in to comment.