UNPKG
miniprogram-setup
Version:
latest (0.1.4)
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.6
0.0.5
0.0.4
0.0.3
0.0.2
0.0.1
小程序支持 setup 选项
github.com/zhangzhonghe/miniprogram-lifecycle
zhangzhonghe/miniprogram-lifecycle
miniprogram-setup
/
__tests__
/
components
/
Timer
/
Timer.ts
22 lines
(17 loc)
•
332 B
text/typescript
View Raw
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
import
{
ComponentWithSetup
}
from
'@/index'
ComponentWithSetup
({
setup
(
) {
let
count =
0
setTimeout
(
() =>
{ count++ })
const
timerId =
setInterval
(
() =>
{ count++
if
(count >=
3
)
clearInterval
(timerId) },
1000
)
return
() =>
({ count, }) }, })