preface

Recently made a sparrow is small, the five organs of the micro channel small program project. Look at it, use it, break it. Some pits really make you cry. I love to do predecessors trees descendants cool things, see the article you, perhaps is a fellow, look at each other with a smile; Or small program periphery people, issued a “ha ha ha ha ha ha ha” laughter. Only say what I stepped on, didn’t step on I dare not nonsense

1. CSS cannot directly use local image resources

The front end uses background images in CSS too often.

If you write a long list of CSS styles, and everything depends on the parent container of the background image, it tells you that using native images directly is not supported. Ha ha ha is not a head? Mistakes like this

Using Base64 in CSS is even more of a disaster scene (the base64 of one image is too long)

Too sad to show the picture (feel sorry for myself)

But the way to do it is to find an online image generated base64 site, take base64 and put it in the URL and the second way is to honestly upload the image to your serverCopy the code

2. The background cannot receive the parameters in the POST request.

Params does not process the parameter as undefined or as the interface module is encapsulated.

But none of the above, get requests can accept arguments.

Get Content-Type = post content-Type = get Content-Type = post Content-Type

The default content-type of applets is Application /json

For post requests, header should be Application /x-www-form-urlencoded

header: {
        'content-type': 'application/x-www-form-urlencoded'
      },
 
Copy the code

3. Obtain the mobile phone number

Wechat small program can get the user’s mobile phone number, good is good is a little long reflection arc

If you were busy implementing the function to get your phone number in the first place you might run into this situation (details)

First be sure to pay attention to obtaining mobile phone numbers only for authenticated applets

The appID you use does not have permission

Login small program management background, small program basic information to see whether the authentication

If there is no certification, go to certification! It usually takes 1-3 working days (we passed the audit on the second day anyway)

Say a little

Developer tools cannot test for mobile phone numbers

but

Can use the real machine debugging !!!!!

4. App onLaunch() is not the same as Page onLoad()

This one accidentally died on this detail

app onLaunch()

page onLoad()

Also remember that the APP will only be called again after it has been destroyed to update options

Pay attention to applets life cycle!!

To be continued…