diff --git a/package.json b/package.json index 9d39fa7..137c534 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ahooks-vue", - "version": "0.13.0", + "version": "0.13.1", "description": "ahooks-vue", "types": "dist/src/index.d.ts", "repository": "https://github.com/dewfall123/ahooks-vue.git", diff --git a/src/utils/lifeCircle.ts b/src/utils/lifeCircle.ts index 1f90c0d..75919bb 100644 --- a/src/utils/lifeCircle.ts +++ b/src/utils/lifeCircle.ts @@ -1,7 +1,9 @@ import { getCurrentInstance, onMounted } from 'vue-demi'; export function safeOnMounted(hook: () => any) { - const instance = getCurrentInstance(); + let instance = getCurrentInstance(); + // @ts-ignore + instance = instance?.proxy || instance; if (instance?.isMounted || (instance as any)._isMounted) { hook(); } else {