Small micro-channel recording a program entry: this.setData ()

this

   this means that should the current Page object. this.data probably refers to js code Page function data attributes, which can. go call the variable data has been defined by this.data. (JavaScript can refer to the interpretation of this is: http://caibaojian.com/deep-in-javascript-this.html )

 Tip:this The value of which is not an object placed inside the function is defined by the decision, but when the function is performed by who evoke the decision.

this.setData({}):

   Action:. SetData function is mainly used to transmit data to view logical layer level, while the corresponding change this.data value.

   Parameter defines: Object to key: value representation will change the value of the key corresponding to the value this.data.

 

working principle

View layer applet as rendered WebView currently used carrier, and the logical layer is made as an independent JavascriptCore operating environment. In the framework, and the WebView JavascriptCore are independent modules, it does not have the shared data channel directly. Currently, the view layer and the data transfer logic layer, provided on both sides by actually  evaluateJavascript implemented. I.e., the user data transmission, transmission needs to be converted to a string, and the converted content data together into a JS script, and then passed to the environment on both sides in the form of an independent execution of the JS script. The  evaluateJavascript execution will be affected by many aspects of the data arrives at the view layer is not real-time. (The official explanation Source: https://developers.weixin.qq.com/miniprogram/dev/framework/performance/tips.html )

Other reference links: https://www.jb51.net/article/168701.htm

                         https://www.cnblogs.com/simuhunluo/p/7989461.html

Released three original articles · won praise 0 · Views 96

Guess you like

Origin blog.csdn.net/Tensor6689/article/details/104672453