Home>Article>WeChat Applet> Summarize and share some practical knowledge in small program development
This article summarizes and shares with you some practical knowledge in small program development. I hope it will be helpful to everyone!
Understand the rendering principle of the mini program
Background
In web development, since js is single-threaded, scripts sometimes run for a long time, causing the page to lose response. There are currently three ways to render pages:
In the mini program, the Hybrid rendering method is selected, the logic layer and the view layer are separated, and run using dual threads. WebView is used to render the interface of the view layer, and the logic layer runs in JSCore.
Dual-thread model of mini program:
Do you really understand the connection between appId, uniId and openId
openID
openID is assigned uniformly to users by the WeChat public platform. As we all know, WeChat mini programs and WeChat public accounts are maintained on the WeChat public platform. In order to distinguish users, each public account and mini program provides a unique ID for each user. Each user generates a unique openID
UnionID
UnionID is the ID assigned to WeChat users by the WeChat open platform. For applications under the same open platform, WeChat users will have a unique UnionID
For example: your company has two applications, mini program A and WeChat official account B, user information of A and B is required By opening up, two applications A and B can be bound to the same open platform. The WeChat open platform will generate a unique UnionID for WeChat users. After authorized login and registration, the UnionID will be stored in the user table, and will be opened from the same open platform in the future. After other applications under the platform are authorized to log in and get the UnionID, they can directly return the user information,
AppID
AppID is the unique identifier of different applications
For example: your company has one mini program, one official account and two applications, AppId is the unique identifier of these two applications
Take you to summarize the jumping ability of the mini program, so that you can accept leadership inspection at any time
A friend today He complained to me that he is currently working in a small and medium-sized company. The bosses are having a meeting in the conference room. The big boss has a question about mini program jump. A leader A, who didn't know which part he was responsible for, came out and first asked about operation and maintenance, and then asked about back-end Java. Java boss said that this belongs to the front-end category, and they were more clear. After hearing this, leader A directly said, what does the front-end know? Then he walked into the conference room and gave feedback to the big boss. No one knew. He told me before that their company’s front-end status is low. This is really low.
h5 Jump Mini Program
Product: Xiaoyang , our official account needs to jump to a certain applet by clicking this button. This function must be implemented
Okay, now that we have the requirements, let’s start with the plan
- Option 1: Click the button, give a pop-up box, and put it in the pop-up box A QR code. Guide users to long press to identify the
- operation process field, the user conversion rate is low, and most users are basically too lazy to operate
- Option 2: Use WeChat’s open label wx -open-launch-weapp
- You can jump to any legal and compliant mini program (I feel there will be more restrictions on this function later)
Passed After discussing with the product, the second option is more suitable. Start with:
Steps:
wx.config({ debug: false, appId: '', // 公众号唯一标识 timestamp: '', // 生成签名的时间戳 nonceStr: '', // 生成签名的随机串 signature: '', // 签名 jsApiList: ["wx-open-launch-weapp"], openTagList: ["wx-open-launch-weapp"] // 微信开放标签 小程序跳转按钮:}); // 通过ready处理成功验证 wx.ready(function () { console.log('ready') }) // 处理失败验证 wx.error(function(error) { console.error("err", error); });
The WeChat customer service message contains a jump applet link
文本内容....点击跳小程序
小程序跳转小程序
wx.navigateToMiniProgram({ envVersion: 'release', // 要打开的小程序版本,develop: 开发版,trial:体验版,release:正式版。仅在当前小程序为开发版或体验版时此参数有效。 appId: ’‘, // 跳转appid path: ’‘ // 跳转路径 })
【相关学习推荐:小程序开发教程】
The above is the detailed content of Summarize and share some practical knowledge in small program development. For more information, please follow other related articles on the PHP Chinese website!