Skip to content

Commit f0a7744

Browse files
authored
Merge pull request KazanExpress#464 from tbl0605/bug-463
Fix for error "No input element found" (bug KazanExpress#463)
2 parents c46db23 + 4c3a7e2 commit f0a7744

File tree

6 files changed

+46
-38
lines changed

6 files changed

+46
-38
lines changed

dist/cjs.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ function _await(value, then, direct) {
6262
return result.then(then);
6363
}return then(result);
6464
}function _invokeIgnored(body) {
65-
var result = body();
66-
if (result && result.then) {
65+
var result = body();if (result && result.then) {
6766
return result.then(_empty);
6867
}
6968
}function _catch(body, recover) {
@@ -75,7 +74,6 @@ function _await(value, then, direct) {
7574
return result.then(void 0, recover);
7675
}return result;
7776
}function _finally(body, finalizer) {
78-
7977
try {
8078
var result = body();
8179
} catch (e) {
@@ -280,14 +278,16 @@ function _await(value, then, direct) {
280278

281279
return _await(_this3.$slots.default, function () {
282280

283-
_this3.inputElement = _this3.$refs['inputSlot'].querySelector('input');
281+
_this3.$nextTick(function () {
282+
_this3.inputElement = _this3.$refs['inputSlot'].querySelector('input');
284283

285-
if (_this3.inputElement) {
286-
_this3.setInputAriaAttributes();
287-
_this3.prepareEventHandlers(true);
288-
} else {
289-
console.error('No input element found');
290-
}
284+
if (_this3.inputElement) {
285+
_this3.setInputAriaAttributes();
286+
_this3.prepareEventHandlers(true);
287+
} else {
288+
console.error('No input element found');
289+
}
290+
});
291291
});
292292
} catch (e) {
293293
return Promise.reject(e);
@@ -595,7 +595,9 @@ function _await(value, then, direct) {
595595
if (this.text.length < this.minLength) {
596596
this.hideList();
597597
return;
598-
}if (this.debounce) {
598+
}
599+
600+
if (this.debounce) {
599601
clearTimeout(this.timeoutInstance);
600602
this.timeoutInstance = setTimeout(this.research, this.debounce);
601603
} else {

dist/es6.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,7 @@ function _await(value, then, direct) {
5656
return result.then(then);
5757
}return then(result);
5858
}function _invokeIgnored(body) {
59-
var result = body();
60-
if (result && result.then) {
59+
var result = body();if (result && result.then) {
6160
return result.then(_empty);
6261
}
6362
}function _catch(body, recover) {
@@ -69,7 +68,6 @@ function _await(value, then, direct) {
6968
return result.then(void 0, recover);
7069
}return result;
7170
}function _finally(body, finalizer) {
72-
7371
try {
7472
var result = body();
7573
} catch (e) {
@@ -260,14 +258,16 @@ function _await(value, then, direct) {
260258

261259
return _await(_this.$slots.default, function () {
262260

263-
_this.inputElement = _this.$refs['inputSlot'].querySelector('input');
261+
_this.$nextTick(() => {
262+
_this.inputElement = _this.$refs['inputSlot'].querySelector('input');
264263

265-
if (_this.inputElement) {
266-
_this.setInputAriaAttributes();
267-
_this.prepareEventHandlers(true);
268-
} else {
269-
console.error('No input element found');
270-
}
264+
if (_this.inputElement) {
265+
_this.setInputAriaAttributes();
266+
_this.prepareEventHandlers(true);
267+
} else {
268+
console.error('No input element found');
269+
}
270+
});
271271
});
272272
}),
273273

@@ -564,7 +564,9 @@ function _await(value, then, direct) {
564564
if (this.text.length < this.minLength) {
565565
this.hideList();
566566
return;
567-
}if (this.debounce) {
567+
}
568+
569+
if (this.debounce) {
568570
clearTimeout(this.timeoutInstance);
569571
this.timeoutInstance = setTimeout(this.research, this.debounce);
570572
} else {

dist/es7.js

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -212,14 +212,16 @@ var VueSimpleSuggest = {
212212
async mounted() {
213213
await this.$slots.default;
214214

215-
this.inputElement = this.$refs['inputSlot'].querySelector('input');
215+
this.$nextTick(() => {
216+
this.inputElement = this.$refs['inputSlot'].querySelector('input');
216217

217-
if (this.inputElement) {
218-
this.setInputAriaAttributes();
219-
this.prepareEventHandlers(true);
220-
} else {
221-
console.error('No input element found');
222-
}
218+
if (this.inputElement) {
219+
this.setInputAriaAttributes();
220+
this.prepareEventHandlers(true);
221+
} else {
222+
console.error('No input element found');
223+
}
224+
});
223225
},
224226
beforeDestroy() {
225227
this.prepareEventHandlers(false);

dist/iife.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/umd.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/vue-simple-suggest.vue

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,14 +228,16 @@ export default {
228228
async mounted () {
229229
await this.$slots.default;
230230
231-
this.inputElement = this.$refs['inputSlot'].querySelector('input')
231+
this.$nextTick(() => {
232+
this.inputElement = this.$refs['inputSlot'].querySelector('input')
232233
233-
if (this.inputElement) {
234-
this.setInputAriaAttributes()
235-
this.prepareEventHandlers(true)
236-
} else {
237-
console.error('No input element found')
238-
}
234+
if (this.inputElement) {
235+
this.setInputAriaAttributes()
236+
this.prepareEventHandlers(true)
237+
} else {
238+
console.error('No input element found')
239+
}
240+
})
239241
},
240242
beforeDestroy () {
241243
this.prepareEventHandlers(false)

0 commit comments

Comments
 (0)