WeChat mini program tool details
javascript && wxss
WeChat applet runs on three terminals: iOS, Android and developer tools for debugging.
The script execution environment of the three terminals and the environment used to render non-native components are different:
- On iOS, the javascript code of the applet runs in JavaScriptCore , is rendered by WKWebView, the environment is iOS8, iOS9, iOS10
- On Android, the javascript code of the applet is parsed through X5 JSCore and rendered by X5 based on the Mobile Chrome 37 kernel
- In the development tools, the javascript code of the mini program runs in nwjs and is rendered by Chrome Webview
Although the environments of the three terminals are very similar, there are still some differences :
ES6
Syntax support for inconsistent syntax. Developers can circumvent this by enabling theES6
toES5
function. DetailsES6
Inconsistent API support Considering the limitation of code package size, the API currently requires developers to introduce relevant class libraries for processing, which can be processed through caniuse Or X5 compatibility query to find out the support status of relevant APIwxss
Rendering performance is inconsistent. Although most of the problem details can be avoided by turning on style completion, it is still recommended to develop Readers need to check the actual performance of the mini program on iOS and Android.
Debugging of the code scanning interface
It is different from directly calling the camera to scan the code on the mobile phone. On PC or Mac It is an inefficient behavior to call the camera to scan the code to complete the debugging. Therefore, after calling the QR code scanning API on the development tool, the developer can select a local picture for subsequent logical debugging instead of actually enabling the camera. Come to scan the code, the process is different, but the input and output of the interface are the same.
Debugging of WeChat payment
The latest version of the developer tools already supports the debugging of WeChat payment, but in order to take into account security, the same as on the mobile phone Calling WeChat Pay directly is different.
- Newly bound developers will need 24 hours before they have permission to debug WeChat Pay
- After the developer calls the WeChat Pay API on the tool, a development tool will appear. For QR codes, developers must use the WeChat ID currently used for development to scan the code and complete the payment process on their mobile phones.
- The tool will synchronize the return package of the mobile WeChat payment to the tool, and the developer will perform the follow-up on his own. Operation
Sharing debugging
- Calling sharing on the developer tools is a simulated behavior and will not Real sharing to users, developers can use this simulated behavior to determine whether the sharing API is correctly called
- Before compiling the mini program on the tool, developers can set the startup page and parameters to help debug the person being shared. Scenario of opening the mini program and locating to the relevant page
- When submitting the preview, developers can also set the startup page and parameters to help debug the real performance of the mobile terminal
Client trusted domain name verification
In the scenario where developers use mobile phones to scan QR codes for debugging, after turning on the debugging mode, the latest version of the client will not check the trusted domain name.
Client trusted domain name verification
Developers use mobile phones In the QR code debugging scenario, after turning on the debugging mode, the latest version of the client will not check the trusted domain name.
Client trusted domain name verification
In the scenario where the developer uses the mobile phone to scan the QR code for debugging, after turning on the debugging mode, the latest version of the client will not check the trusted domain name.
The code file must be encoded in UTF8
Only the UTF8 encoding format is supported under iOS. The latest version of the developer tool will encode the code file once when uploading the code. Coding format verification.
ES6 API support status
In 6.5.3 and previous versions of WeChat, the ES6 API support status of mini programs is as follows:
tip
: TBS 2.0 TBS 3.0 is the X5 kernel versiontip
: WeChat will complete the full TBS 3.0 kernel upgrade before February 2017
#