mirror of
https://github.com/Hopiu/vue-material.git
synced 2026-03-16 22:10:27 +00:00
check initial value for multiple selects #245
This commit is contained in:
parent
29f84e1131
commit
39cd6f38f5
1 changed files with 6 additions and 3 deletions
|
|
@ -50,8 +50,11 @@
|
|||
}
|
||||
},
|
||||
methods: {
|
||||
isMultiple() {
|
||||
return this.parentSelect.multiple;
|
||||
},
|
||||
setParentOption() {
|
||||
if (!this.parentSelect.multiple) {
|
||||
if (!this.isMultiple()) {
|
||||
this.parentSelect.selectOption(this.value, this.$refs.item.textContent);
|
||||
} else {
|
||||
this.check = !this.check;
|
||||
|
|
@ -64,7 +67,7 @@
|
|||
},
|
||||
watch: {
|
||||
isSelected(selected) {
|
||||
if (this.parentSelect.multiple) {
|
||||
if (this.isMultiple()) {
|
||||
this.check = selected;
|
||||
}
|
||||
},
|
||||
|
|
@ -90,7 +93,7 @@
|
|||
this.parentSelect.multipleOptions[this.index] = {};
|
||||
this.parentSelect.options[this.index] = this;
|
||||
|
||||
if (this.parentSelect.value === this.value) {
|
||||
if (this.isMultiple() && this.parentSelect.value.indexOf(this.value) >= 0 || this.parentSelect.value === this.value) {
|
||||
this.setParentOption();
|
||||
}
|
||||
},
|
||||
|
|
|
|||
Loading…
Reference in a new issue