4
我想在異步Web服務請求完成時在webview中加載動態html字符串。我怎樣才能做到這一點?如何在webview中加載動態html字符串
<WebView source={{html: dynamichtml}}/>
getMoviesFromApiAsync()
{
return fetch('*****some url*****')
.then((response) => response.json())
.then((responseJson) => {
this.setState({isLoading: false, jsonData: responseJson});
this.getDataFromServer(responseJson);
return responseJson;
})
.catch((error) => {
console.error(error);
});
}
getDataFromServer(responseJson)
{
var a ='ravi';
var b = 'chennai';
var commonHtml = `my name is ${a} from ${b}`;
<WebView source={{html: commonHtml}}/> // not working
}
嗨,任何提前? – jose920405