更新 src/components/Echarts/index.js
This commit is contained in:
parent
425d304879
commit
17054bc5a5
|
|
@ -12,7 +12,7 @@ export default class App extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
componentWillReceiveProps(nextProps) {
|
UNSAFE_componentWillReceiveProps(nextProps) {
|
||||||
if(nextProps.option !== this.props.option) {
|
if(nextProps.option !== this.props.option) {
|
||||||
this.refs.chart.reload();
|
this.refs.chart.reload();
|
||||||
}
|
}
|
||||||
|
|
@ -23,6 +23,10 @@ export default class App extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
const source = Platform.OS === 'ios'
|
||||||
|
? require('./tpl.html') // iOS使用require方式加载
|
||||||
|
: { uri: 'file:///android_asset/tpl.html' }; // Android从assets目录加载
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<View style={{flex: 1, height: this.props.height || 400,}}>
|
<View style={{flex: 1, height: this.props.height || 400,}}>
|
||||||
<WebView
|
<WebView
|
||||||
|
|
@ -35,7 +39,7 @@ export default class App extends Component {
|
||||||
}}
|
}}
|
||||||
scalesPageToFit={Platform.OS !== 'ios'}
|
scalesPageToFit={Platform.OS !== 'ios'}
|
||||||
originWhitelist={['*']}
|
originWhitelist={['*']}
|
||||||
source={require('./tpl.html')}
|
source={source}
|
||||||
onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null}
|
onMessage={event => this.props.onPress ? this.props.onPress(JSON.parse(event.nativeEvent.data)) : null}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue