Skip to content

Commit 19058d7

Browse files
pdanpdanrstoenescu
authored andcommitted
Add guards for parent field in QAutocomplete and watch noParentField (quasarframework#1956)
1 parent fae0748 commit 19058d7

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

src/components/autocomplete/QAutocomplete.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,9 @@ export default {
192192
this.__inputDebounce.setChildDebounce(true)
193193
}
194194
this.$nextTick(() => {
195-
this.inputEl = this.__input.getEl()
195+
if (this.__input) {
196+
this.inputEl = this.__input.getEl()
197+
}
196198
this.inputEl.addEventListener('keydown', this.__keyboardHandleKey)
197199
this.inputEl.addEventListener('blur', this.blurHide)
198200
})

src/mixins/parent-field.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,14 @@ export default {
88
props: {
99
noParentField: Boolean
1010
},
11+
watch: {
12+
noParentField (val) {
13+
if (!this.field) {
14+
return
15+
}
16+
this.field[val ? '__registerInput' : '__unregisterInput'](this)
17+
}
18+
},
1119
beforeMount () {
1220
if (!this.noParentField && this.field) {
1321
this.field.__registerInput(this)

0 commit comments

Comments
 (0)