# getNetType

获取当前设备网络类型

# 调用方式

getNetType(params)
1

返回 Promise,使用 then/catch 或 await 处理结果。 接收单个业务参数;是否需要传参按下方参数表约定,无业务参数时可省略。具体字段及返回数据由宿主原生约定。

# 请求参数

参数对象字段由宿主约定;调用签名见上方。

# 接口调用示例

this.$bridge.getNetType()
1

# 返回参数

Prop Type Default Description
net_type String 网络类型: WIFI / LAN

# 接口返回示例

let networkType = 'WIFI';
try {
  const res = await this.$bridge.getNetType();
  networkType = res.net_type;
} catch (error) {
  this.$bridge.log('networkType get error');
}
1
2
3
4
5
6
7