<WebView ref={webView => this.webView = webView}source={furi: config.API_BASE_URI +/mobile-backend/SignSDK/index.html'}}source={f'http://uygzacps.ydthlife.com/mobile-backend/signPage.html'}] mediaPlaybackRequiresUserAction={false]onMessage={(e) => this.onMessage(e)} startInLoadingState={true} automaticallyAdjustContentInsets={truelscalesPageToFit=true} style={{width:100%', flex: 1}} bounces={false} scrollEnabled={true} injectedJavaScript={this.signOnLoad()} contentInset={{top: , left: , right: 0, bottom: 0}}/>无法访问html报错Can't open url: cloudwise-agent:
时间: 2024-04-25 10:27:13 浏览: 5
根据你提供的代码,我发现 WebView 组件的 "source" 属性存在一些问题,可能导致 URL 地址无法正常加载。具体的问题在于,你同时在 "source" 属性中设置了一个 "furi" 和一个 "source" 属性,这样会导致 WebView 组件无法正确解析 URL。另外,如果你的 H5 页面中使用了某些非标准的 URL Scheme 或者协议(比如 "cloudwise-agent"),WebView 组件会默认禁止访问这些 URL,需要你手动设置 "originWhitelist" 属性来允许访问。
为了解决这个问题,你可以尝试修改代码如下:
```
<WebView
ref={webView => this.webView = webView}
source={{ uri: 'http://uygzacps.ydthlife.com/mobile-backend/signPage.html' }}
mediaPlaybackRequiresUserAction={false}
onMessage={(e) => this.onMessage(e)}
startInLoadingState={true}
automaticallyAdjustContentInsets={true}
scalesPageToFit={true}
style={{ width: '100%', flex: 1 }}
bounces={false}
scrollEnabled={true}
injectedJavaScript={this.signOnLoad()}
originWhitelist={['http://*', 'https://*', 'file://*', 'cloudwise-agent:*']}
contentInset={{ top: 0, left: 0, right: 0, bottom: 0 }}
/>
```
在这个例子中,我们将 "source" 属性设置为一个对象,其中 "uri" 字段指定了要加载的 URL 地址。我们还添加了 "scalesPageToFit" 属性来允许页面自适应屏幕大小。另外,我们也设置了 "originWhitelist" 属性来允许访问 "cloudwise-agent" 协议的 URL。你可以根据实际情况修改 "originWhitelist" 属性的值,以满足你的需求。