Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composition API Support & AutoComplete Component Fix #15

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion src/components/autocomplete.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
22 changes: 19 additions & 3 deletions src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand All @@ -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
},
})
Expand Down