Alipay small program development - stepped pit Record

A rich text components directly inline html code problems encountered:

abnormal situation:

  • Completely embedded html show and no error
  • Click on hyperlinks embedded in html no response (whitelisted)

1. does not support hyperlinks:

Normal hyperlink click no response has been reflected to Alipay applet technical support, confirmed bug, to be repaired.

2. <br> does not support such an approach:

Need to write in strict mode, such as non-closed tags, labels need to complete the internal closure, or will cause can not resolve all the html rendering.

Second, non-applet front end - Jump applet link splicing question:

abnormal situation:

  • According to official documents spliced ​​link can not open the page with the parameters of normal

The official document:

The official solution provided See how to jump applet .

Stepped pit practical operation:

If the page configuration parameters are not okay, no problem, if there are parameters, it is possible with out carrying the links can not obtain parameters, pit here:

1.page parameters: first thought it was a page path path (that is, the path app.json), as well as behind the query parameters, of course, we will consider here only path;

2.query parameters: Although see the "Startup Parameters" words, but this path does not start with too small parameters of the program app, micro-channel applet is not so fun, so here is considered to be granted page parameters a;

Then spliced ​​out of the path is this:

window.location.href="alipays://platformapi/startapp?appId=xxx&page=pages/goodDetail/goodDetail&query=goods_id%3d101"

Obviously, this can not get a normal page parameters.

Proper operation:

// There are page parameters (no startup parameters) 
location.href = "alipays:? // platformapi / startapp appId = xxx & Page = Pages and the / goodDetail / goodDetail" + the encodeURIComponent ( "? Goods_id =" + goods_id)
// There are page parameters, there are startup parameters (such as number of channels, platforms and other open No. applet will need to pass over the parameters) 
location.href = "alipays:? // platformapi / startapp appId = xxx & Page = Pages and the / goodDetail / goodDetail "+ the encodeURIComponent ("? goods_id = "+ goods_id) + & Query = the encodeURIComponent (" appParams = "+ xx)

to sum up:

Official document highlights the startup parameters, but simply did not mention the page parameters, initial contact, stepped pit is inevitable, after all, Alipay small program is still growing, we ourselves have much more practice, a lot of attempts.

Three applet parameters generated with the background of the two-dimensional code can not open the page properly:

Abnormal description:

  • Code management applet background, the resulting two-dimensional code with no parameters can be a normal visit, you can not access the page with parameters (parameter acquisition less)

Stepped pit practical operation:

 

As habitual custom compilation mode configuration page addresses and parameters as development tools, and then appeared in the pit - a total of three configuration parameters:

Page address - and app.json pages need to be consistent in the address;

Start parameters - obviously not the page parameters (Jump as minor procedural issues with the front), and page parameters are ignored (there is no good sense of page parameters);

Code description - this would not have said.

In this way configuration, no page parameters, naturally can not access the page.

Configured correctly:

Page address in Page path completed, while the page parameters also added back (without transcoding), start parameters required (even if not also have to fill in a parameter), as follows:

So configured on it.

Expand usage:

After the applet background generated two-dimensional code decoding is   HTTPS: // qr.alipay.com/s6x041d3str6e1tr35h13s  hyperlink like, validated, can be transferred from Alipay applets directly into your mobile browser, so you can directly replace the top alipay the path of joining the agreement, and this method is more direct, more simple, less error-prone (provided that the configuration code to be correct, normally access the page).

Guess you like

Origin www.cnblogs.com/xyyt/p/11359546.html