Skip to content

Commit

Permalink
feat: 支持vue2.7
Browse files Browse the repository at this point in the history
  • Loading branch information
zuofenghua committed Jul 11, 2022
1 parent 460fe33 commit c908056
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 3 additions & 1 deletion src/utils/lifeCircle.ts
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down

0 comments on commit c908056

Please sign in to comment.