Scan the QR code on WeChat to jump to the specified page of the WeChat Mini Program

Project scenario:

Users want to directly enter the mini program by scanning the QR code of the laboratory on WeChat to apply for joining the laboratory


How to deal with it

1. First of all, we need to go to the development management of the WeChat public platform --> development settings, find (scan the QR code of the common link to open the applet), click Add, and the following page will appear. After configuration, click Save

insert image description here
insert image description here

Fill in the page configuration and click save to publishinsert image description here


2. Receive parameters on the page to be redirected in the WeChat applet, in the onLoad method

onLoad((option) => {
    
    
	console.log(option)
	
	if(option.q&&option.q!="undefined"){
    
    
		// 获取到二维码原始链接内容
		const qrUrl = decodeURIComponent(option.q) 
		console.log(qrUrl);
		//此处就是我们要获取的参数 json
			
	}				
});


3. Scan the QR code to jump to the Mini Program page (the domain name path returned by the QR code must be the same as the one set in the WeChat official page)

Guess you like

Origin blog.csdn.net/qq_44854653/article/details/131246113