May 20, 2021 WeChat Mini Program Development Document
Small program developer tools are simulations of WeChat clients, limited by the differences between desktop devices and mobile devices, as well as some of WeChat's endethy data, and given the ease of development, some APIs are different in tools and WeChat.
Different from calling the camera directly on the phone to sweep the code, calling the camera on the PC or Mac to sweep the code to complete debugging is an inefficient behavior, so after calling the QR code broom API on the development tool, the developer can choose a local picture for subsequent logical debugging, instead of instead of ingout the camera to sweep the code, the process is different, but the input and output of the interface is consistent.
The latest version of the developer tool already supports weChat payment debugging, but for security reasons, it's different from calling WeChat payment directly on your phone:
The interaction used is different, but the input and output tools of the interface are consistent with the client.
Developer tools call forwarding is a simulated behavior, and does not truly forward to users, and development can be judged by this simulation behavior to forward the forward API.
For more forward information, such as the name of the group and group identifier OpenGID.On the small program developer tool, developers can debug forward with Shareticket in the following ways.
When calling wx.showsharemenu's parameter withshareticket, when you click the forward button that appears after the first upper right corner menu in the emulator, a list of test groups will appear, as shown in the figure:
Developers click to select any group, you can get the Shareticket by calling wx.getshareInfo by calling wx.getshareInfo.
When the developer needs to debug a bit of a group point, and the scene with Shareticket, you can use the 1044 in custom compilation. The small program message card (with Shareticket) in the group chat session can select any analog test group., As shown
In the WeChat client, the user may open the applet in each scene. Detail However, in the developer tool is no real environment to simulate these scenes.Developers can meet the purpose of debugging different scenes by conditional compilation.
In daily use, users can open a small program, and based on the incoming Path jump to the corresponding small program page instead of the page, or can pass the parameters to distinguish the apparatus, the developer tool, developerIt can also achieve the purpose of debugging different PATH and parameters by means of conditional compilation.
For example, the figure below is the selection page is pages / name / name parameter is name = linchao
same Start using custom parameters Similarly, when submitting previews, developers can achieve the purpose of debugging different PATH and parameters on mobile devices by custom preview.
For example, the figure below is the selection page is pages / name / name parameter is name = linchao
The small program jump development and commissioning can be divided into two parts.
For the safety considerations of the small program code, when calling wx.navigatetominiprogram on the tool, the developer tool does not truly open and jump to another applet, but the tool will determine the current applet and a small program that needs to jump.The binding relationship between, and outputs information to the developer.Developers can determine whether the call is successful based on success or failback callback functions.
choose Custom compilation Enter the scene selection 1037 entry from a small program You can debug your applet whether the correct parameter is received and the relevant processing is performed.
Select Custom Compilation Enter Scenario Select 1038 Return from Small Program Can debug the small program to return when it receives the correct parameters and does the relevant processing.