+23
-13
lines changedFilter options
+23
-13
lines changed Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
1
1
<template>
2
2
<md-menu-item :class="optionClasses" :disabled="isDisabled" @click="setSelection">
3
-
<md-checkbox class="md-primary" v-model="isChecked" v-if="MdSelect.multiple" />
3
+
<md-checkbox class="md-primary" v-model="isChecked" v-if="MdSelect.multiple" :disabled="isDisabled" />
4
4
5
5
<span class="md-list-item-text" ref="text">
6
6
<slot />
@@ -52,8 +52,17 @@
52
52
}
53
53
},
54
54
watch: {
55
-
inputLabel () {
55
+
selectValue () {
56
56
this.setIsSelected()
57
+
},
58
+
isChecked (val) {
59
+
if (val === this.isSelected) {
60
+
return
61
+
}
62
+
this.setSelection()
63
+
},
64
+
isSelected (val) {
65
+
this.isChecked = val
57
66
}
58
67
},
59
68
methods: {
@@ -67,17 +76,24 @@
67
76
return slot ? slot[0].text.trim() : ''
68
77
},
69
78
setIsSelected () {
70
-
this.isSelected = this.inputLabel === this.getTextContent()
79
+
if (!this.isMultiple) {
80
+
this.isSelected = this.selectValue === this.value
81
+
return
82
+
}
83
+
if (this.selectValue === undefined) {
84
+
this.isSelected = false
85
+
return
86
+
}
87
+
this.isSelected = this.selectValue.includes(this.value)
71
88
},
72
89
setSingleSelection () {
73
90
this.MdSelect.setValue(this.value)
74
91
},
75
92
setMultipleSelection () {
76
-
this.isChecked = !this.isChecked
77
93
this.MdSelect.setMultipleValue(this.value)
78
94
},
79
95
setSelection () {
80
-
if (!this.disabled) {
96
+
if (!this.isDisabled) {
81
97
if (this.isMultiple) {
82
98
this.setMultipleSelection()
83
99
} else {
@@ -95,10 +111,6 @@
95
111
created () {
96
112
this.setItem()
97
113
this.setIsSelected()
98
-
99
-
if (this.isMultiple && this.selectValue && this.selectValue.length) {
100
-
this.isChecked = this.selectValue.includes(this.value)
101
-
}
102
114
}
103
115
}
104
116
</script>
Original file line number Diff line number Diff line change
@@ -89,7 +89,7 @@
89
89
items: {},
90
90
label: null,
91
91
multiple: false,
92
-
modelValue: this.model,
92
+
modelValue: this.localValue,
93
93
setValue: this.setValue,
94
94
setContent: this.setContent,
95
95
setMultipleValue: this.setMultipleValue,
@@ -115,6 +115,7 @@
115
115
immediate: true,
116
116
handler (val) {
117
117
this.setFieldContent()
118
+
this.MdSelect.modelValue = this.localValue
118
119
this.emitSelected(val)
119
120
}
120
121
},
@@ -124,9 +125,6 @@
124
125
this.MdSelect.multiple = isMultiple
125
126
this.$nextTick(() => this.initialLocalValueByDefault())
126
127
}
127
-
},
128
-
model () {
129
-
this.MdSelect.modelValue = this.model
130
128
}
131
129
},
132
130
methods: {
You can’t perform that action at this time.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4