HarmonyOS鸿蒙Next中ArkWeb添加header失败
HarmonyOS鸿蒙Next中ArkWeb添加header失败
我在
Web({ src: "", controller: this.webviewController })
.onControllerAttached(async () => {
if (!AppCache.getInstance().hasClearWebCache) {
AppCache.getInstance().hasClearWebCache = true
this.webviewController.removeCache(true)
}
try {
// 加载带 header 的 URL
this.webviewController.loadUrl(this.url,
[{ headerKey: "token", headerValue: ApiUtils.getToken() }]);
} catch (error) {
console.debug(`ErrorCode: ${(error as BusinessError).code}, Message: ${(error as BusinessError).message}`);
}
})
怎么给web url添加head,我这样添加无效果,打印内容head为空,且h5端那边也没接受到我给的token,直接返回登录
更多关于HarmonyOS鸿蒙Next中ArkWeb添加header失败的实战教程也可以访问 https://www.itying.com/category-93-b0.html
2 回复