文件跨域问题,可尝试通过虚拟域名的方式加载本地html,来规避跨域问题。如原先通过{ src: $rawfile('index.html') } 的方式加载,修改为 { src: "https://your.domain" } 的方式加载,并使用拦截器返回html文本,拦截器使用参考:https://gitee.com/openharmony/docs/pulls/40014/files虚拟域名your.domain保持为和后端接口域名一致就可规避跨域或者新版本有解决跨域的API,参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-webview-V5\#setpathallowinguniversalaccess12
文件跨域问题,可尝试通过虚拟域名的方式加载本地html,来规避跨域问题。如原先通过{ src: $rawfile('index.html') } 的方式加载,修改为 { src: "https://your.domain" } 的方式加载,并使用拦截器返回html文本,拦截器使用参考:
https://gitee.com/openharmony/docs/pulls/40014/files
虚拟域名your.domain保持为和后端接口域名一致就可规避跨域或者新版本有解决跨域的API,参考文档:https://developer.huawei.com/consumer/cn/doc/harmonyos-references-V5/js-apis-webview-V5\#setpathallowinguniversalaccess12