Skip to content

Latest commit

 

History

History
39 lines (30 loc) · 558 Bytes

useDidShowAgain.mdx

File metadata and controls

39 lines (30 loc) · 558 Bytes
title
useDidShowAgain

页面再次显示时的回调

用法

import Taro from '@tarojs/taro'
import { useDidShowAgain } from '@tarojsx/hooks'

const Demo = () => {
    Taro.useDidShow(() => {
        console.log('show')
    })

    // count 为页面显示计数, 从 1 开始.
    const count = useDidShowAgain(() => {
        console.log('show again')
    })
    console.log(count)
}

/* 首次打开页面 */
// show
// 1

/* 进入其他页面后返回 */
// show
// show again
// 2

参考

useDidShowAgain(fn)