赞
踩
首先导入模块
import fetch from '@system.fetch';
然后我们需要在config.jeson文件里配置
首先配置网络访问允许权限
- "module": {
- "reqPermissions": [
- {
- "name": "ohos.permission.GET_NETWORK_INFO"
- },
- {
- "name": "ohos.permission.SET_NETWORK_INFO"
- },
- {
- "name": "ohos.permission.INTERNET"
- }
- ],
- ...
- }
然后配置设备允许网络配置
- "deviceConfig": {
- "default": {
- "process": "com.huawei.hiworld.example",
- "supportBackup": false,
- "network": {
- "cleartextTraffic": t
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。