Skip to content

Commit 93013b9

Browse files
author
zuofenghua
committed
fix: vue2 onMounted bug
1 parent aff290a commit 93013b9

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "ahooks-vue",
3-
"version": "0.12.1",
3+
"version": "0.12.2",
44
"description": "ahooks-vue",
55
"types": "dist/src/index.d.ts",
66
"repository": "https://github.com/dewfall123/ahooks-vue.git",

src/utils/lifeCircle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { getCurrentInstance, onMounted } from 'vue-demi';
22

33
export function safeOnMounted(hook: () => any) {
44
const instance = getCurrentInstance();
5-
if (instance?.isMounted) {
5+
if (instance?.isMounted || (instance as any)._isMounted) {
66
hook();
77
} else {
88
onMounted(hook);

0 commit comments

Comments
 (0)