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

Vue3 Composition API? #129

Open
limsocheat opened this issue Mar 28, 2023 · 1 comment
Open

Vue3 Composition API? #129

limsocheat opened this issue Mar 28, 2023 · 1 comment

Comments

@limsocheat
Copy link

Is there any document for Vue3 Composition API?

@pirhoo
Copy link

pirhoo commented Sep 12, 2024

As far as I know there is no composable for vue wait but you can create one easily:

import { getCurrentInstance } from 'vue'

export function useWait() {
  const instance = getCurrentInstance()
  // If `getCurrentInstance` is called outside of a Vue component setup function, it will return `null`.
  if (!instance) {
    throw new Error('useCore must be called within a Vue component setup function.')
  }
  // The `instance` object has a `proxy` property, which is the component's public instance.
  const { proxy } = instance
  // `proxy.$wait` gives us access to the global `$wait` object provided by vue-wait 
  return proxy.$wait
}

Then to use it:

const wait = useWait()
wait.start('loader name')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants