The last article mainly talks about the life cycle of small program, to understand the life of the late development to understand the operation effect, this article continues to introduce the development and debugging of small program and real machine debugging.

Focus on Spring Boot+ micro services, mini programs, Flutter, Android, regularly share articles and video tutorials, reply to Java materials after attention, receive the learning dry goods carefully prepared for you!

This article is the second in a series of small programs, but knowing the previous article will help you understand it better:

1. Applets (I) Understand applets 2. Applets (II) APPID fetching and project directory structure 3. Small program (3) life cycle

preface

First, development and debugging

Two, real machine debugging


1. Development and debugging

Debugging is very important in the development, whether it is to find exceptions or find and monitor the interface debugging is the only choice, small program development process, debugging is the key to better track problems and solve problems, small program is the same, first learn to debug code.

You can perform the following steps to debug:

Step 1: Click the debugger

Step 2: Click on Sources

Step 3: Find the JS file you want to debug in the directory and open the file in the figure

Step 4: Set breakpoints in the file Move the mouse pointer to the far left of the file and click to set breakpoints

Shortcut key CTRL + B to start debugging

Step 5: Click the arrow button to continue to the next breakpoint

Click the blue button to skip the breakpoint

Step 6: View variable (content information) values

  • Method 1: Place the mouse on a variable to display its value

  • Method 2: In the debugger window, click on the Scope TAB and then click on the corresponding variable

  • Method 3: Use console.log(options); Print it out and view it in the Console window

Step 7: View interface and interface information First find network in the debugger menu, select the interface link can be viewed inside

Step 8: Interface request parameters and header description

Click the interface link, you can see the following:

  • Headers: Request header file, including request path, request mode, request response code, and so on

  • Preview: Displays the tree structure of the data

  • Response: Response result of the interface

  • Cookies: Private Cookies requested

  • Timing: Request time and request response time


2. Real machine debugging

Functions of real machine debugging:

1. Used to verify whether the real machine works properly after development

2. Develop features that need to be developed on a real phone (e.g., taking photos)

The debugging of the real machine requires a legitimate domain name to be used on the real machine. The domain name must be HTTPS and can be used after the background applet is set

Real machine debugging Click the real machine debugging menu, scan the TWO-DIMENSIONAL code for real machine debugging


1. In the simulator, http://IP address can be used to request the server and obtain data successfully under the condition that HTTPS is selected without verifying the legitimate domain name. However, debugging on the real machine requires a legitimate domain name to access the server.

Two, the real machine need to click remote debugging to access the server and debugging.

Iii. If you need to generate an experience version for the convenience of testing, you can click upload on the development tool, and scan the qr code generated by the development version on the public platform –> Development Management –> Development version to check the experience version.


Procedural workplace, a dedicated workplace programmer.