Version: 1.xTaro.onNetworkStatusChange(CALLBACK)监听网络状态变化。CALLBACK 返回参数:参数类型说明isConnectedBoolean当前是否有网络连接networkTypeString网络类型注意:H5 端兼容情况较差,只有当 navigator.connection 支持监听 onChange 事件时才会生效。示例代码#import Taro from '@tarojs/taro' Taro.onNetworkStatusChange(res => { console.log(res.isConnected) console.log(res.networkType)})CopyAPI支持度#API微信小程序H5ReactNativeTaro.onNetworkStatusChange✔️✔️✔️