UNPKG
nk-cli
Version:
latest (1.0.7)
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0
Initialize a vite app fast by NK-CLI
mamba-in.github.io/mamba-forever
mamba-in/mamba-forever
nk-cli
/
template
/
src
/
hooks
/
core
/
onMountedOrActivated.ts
19 lines
(15 loc)
•
290 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import
{ nextTick, onMounted, onActivated }
from
'vue'
;
export
function
onMountedOrActivated
(
hook: Fn
) {
let
mounted
: boolean;
onMounted
(
() =>
{
hook
();
nextTick
(
() =>
{ mounted =
true
; }); });
onActivated
(
() =>
{
if
(mounted) {
hook
(); } }); }