【发布时间】:2018-08-30 07:00:14
【问题描述】:
目前我正在将我的 android assets 文件夹中的 html 文件加载到 webview 中。
dashboard.html 文件包含一些脚本。 如果它是静态的,它工作正常。
<WebView
ref={(component) => (this.webview = component)}
style={{ height: height * 1.3 }}
javaScriptEnabled={true}
domStorageEnabled={true}
source={{uri:'file:///android_asset/graph/pages/dashboard.html'}}
startInLoadingState={true}
javaScriptEnabledAndroid={true}
mixedContentMode={'compatibility'}
/>
但我需要动态更新脚本中的变量。 如何从 react-native 组件访问放置在 assets 文件夹中的脚本。
【问题讨论】:
标签: react-native webview