Skip to content

Commit

Permalink
fix: ReferenceError: Cannot access 'vNodeFn' before initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
hunterliu1003 committed Mar 26, 2024
1 parent b53725e commit b159e1d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/useTemplate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,6 @@ export const useTemplate: UseTemplate = <T extends Component>(
if (_nextTick)
checkError()

if (options?.showByDefault)
show()

if (options?.hideOnUnmounted)
tryOnUnmounted(hide)

const vNodeFn = templateToVNodeFn(template)

async function show() {
Expand All @@ -62,6 +56,12 @@ export const useTemplate: UseTemplate = <T extends Component>(
provider?.vNodeFns.splice(index, 1)
}

if (options?.showByDefault)
show()

if (options?.hideOnUnmounted)
tryOnUnmounted(hide)

return { show, hide }
}

Expand Down

0 comments on commit b159e1d

Please sign in to comment.