
// 监听网络状态变化的自定义 Hook
export default function useNetworkStatusChange(callback: () => void) {

  const OnNetworkStatusChange = (res: any) => {
    console.log('=>(useNetworkStatusChange)', res)

    if (res.isConnected) {
      callback && callback()
    }
  }

  onLoad(() => {
    uni.onNetworkStatusChange(OnNetworkStatusChange)
  })

  onUnload(() => {
    uni.offNetworkStatusChange(OnNetworkStatusChange)
  })
}
