获取国家地区信息
methodName: getCountryInfo
额外参数:
| 属性 | 类型 | 是否必填 | 默认值 | 描述 |
|---|---|---|---|---|
| type | String | 是 | 首选根据 sim 或者 language 获取国家地区信息类型。注:type 不符合要求的话,会走默认逻辑。默认逻辑为:先尝试获取 sim 信息,获取不到则走 language 获取方式。 - sim - language - 可为空(先 sim 后 language) |
success 回调函数
参数
Object res
| 属性 | 类型 | 描述 |
|---|---|---|
| countryCode | String | 国家 |
| mcc | String | 国家码 |
| mnc | String | 网络码 |
| source | String | 来源 |
| success | String | 描述接口调用成功或失败。"true": 成功;"false":失败 |
fail 回调函数
参数
Object res
| 属性 | 类型 | 描述 |
|---|---|---|
| success | String | 描述接口调用成功或失败。"true": 成功;"false":失败 |
| errMsg | String | 错误信息 |
调用示例
const dlt = window['@transsion/byteh5bridge'];
const canCallDlt = dlt && window.dltms && window.dltms.isMiniShellGame();
if (canCallDlt) {
dlt.callApi('getCountryInfo', {
success: (res) => {
console.log('success: ', res);
},
fail: (res) => {
console.log('fail: ', res);
},
complete: (res) => {
console.log('complete: ', res);
},
});
}