Mini Program Native Code:
t looks like a normal Taro component, the most important difference is the
@withWeapp() decorator, which you can interpret as a runtime for conversion code.
@withWeapp() adds some methods and properties that were not available in the original Taro, eg:
The API of the converted
this.setData is equivalent to the polyfill of
this.setData of the mini program, the biggest difference between it and
this.setState is that after
this.setData the data of
data is updated synchronously, while rendering is updated asynchronously, while
setState is updated asynchronously. both are asynchronous.
this.properties are aliases of Taro's
this.props, and when their data is updated, the corresponding
props will be updated as well.
Taro converts the lifecycle of the native mini program into the lifecycle of Taro, and the complete correspondence is as follows.
|Mini Program Lifecycle||Taro Lifecycle|