taro 预加载案例为什么获取到的$preloadData是undefined
-
export default class Index extends Component {
private isFetching
componentWillMount () {
console.log('isFetching: ', this.isFetching)
this.$preloadData
.then(res => {
console.log('res: ', res)
this.isFetching = false
})
}
componentWillPreload (params) {
return this.fetchData(params.url)
}
fetchData (url) {
this.isFetching = true
}
render () {
return (
<View className='index'>
<Text>Hello world!</Text>
</View>
)
}
}