network.js 222 B

123456789
  1. export function onNetworkStatusChange(onlineFun, offlineFun) {
  2. uni.onNetworkStatusChange(res => {
  3. if(res.networkType !== 'none') {
  4. onlineFun && onlineFun(res);
  5. } else{
  6. offlineFun && offlineFun(res);
  7. }
  8. });
  9. }