diff --git a/src/components/autocomplete.vue b/src/components/autocomplete.vue index 7ee1279..7b08be4 100644 --- a/src/components/autocomplete.vue +++ b/src/components/autocomplete.vue @@ -57,7 +57,17 @@ export default { const refName = _this.$slots.input()[0].props.ref; const scopedInput = _this.$slots.input()[0].ref.i.ctx.$refs[refName]; if (scopedInput) { - refInput = scopedInput.$el.getElementsByTagName('input')[0]; + refInput = scopedInput; + if(refInput.tagName.toLowerCase() !== 'input'){ + const inputs = refInput.querySelectorAll('input') + if(inputs.length == 0){ + console.error('No input tag found inside ref "'+refName+'"') + } else { + refInput = inputs[0] + } + } + } else { + console.error("Failed to find scopedInput (element with ref='"+refName+"')") } } if (this.selectFirstOnEnter) { diff --git a/src/main.js b/src/main.js index 8b639a7..8424c45 100644 --- a/src/main.js +++ b/src/main.js @@ -17,6 +17,9 @@ import buildComponent from './components/build-component' import MountableMixin from './utils/mountableMixin' import {Env} from "./utils/env"; let GMapApi = null; +let gmapApiPromiseLazy = null; +let gmapOptions = {} +let defaultResizeBus = null; export { loadGMapApi, @@ -35,6 +38,18 @@ export { MountableMixin, } +export function useGMapApiPromiseLazy() { + return gmapApiPromiseLazy; +} + +export function useGMapOptions() { + return gmapOptions; +} + +export function useGMapDefaultResizeBus() { + return defaultResizeBus +} + export default function install(Vue, options) { options = { installComponents: true, @@ -48,16 +63,17 @@ export default function install(Vue, options) { }, }) - const defaultResizeBus = createApp() + defaultResizeBus = createApp() // Use a lazy to only load the API when // a VGM component is loaded - let gmapApiPromiseLazy = makeGMapApiPromiseLazy(options) + gmapApiPromiseLazy = makeGMapApiPromiseLazy(options); + gmapOptions = options; Vue.mixin({ created() { this.$gmapDefaultResizeBus = defaultResizeBus - this.$gmapOptions = options + this.$gmapOptions = gmapOptions this.$gmapApiPromiseLazy = gmapApiPromiseLazy }, })