You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
		
			
				
					
					
						
							53 lines
						
					
					
						
							1.4 KiB
						
					
					
				
			
		
		
		
			
			
			
				
					
				
				
					
				
			
		
		
	
	
							53 lines
						
					
					
						
							1.4 KiB
						
					
					
				| 
 | |
| export const myMixins ={ | |
| 	data() { | |
| 		return { | |
| 			shareParam: {}, | |
| 		} | |
| 	}, | |
| 	 | |
| 	onLoad(option) { | |
| 		console.log('option',option) | |
| 		if(option && option.wechat_qrcode){ | |
| 			uni.setStorageSync('wechat_qrcode',option.wechat_qrcode) | |
| 		} | |
| 		// 分享 | |
| 		uni.showShareMenu({ | |
| 			withShareTicket: true, | |
| 			//设置下方的Menus菜单,才能够让发送给朋友与分享到朋友圈两个按钮可以点击 | |
| 			menus: ["shareAppMessage", "shareTimeline"] | |
| 		}) | |
| 	}, | |
| 	// 分享到朋友圈     | |
| 	onShareTimeline() { | |
| 		return { | |
| 			title: '时味苏州', | |
| 			type: 0, | |
| 			summary: "edewdewdewf", | |
| 			imageUrl: "https://static.ticket.sz-trip.com/uploads/20250818/5ea2c18a15db8a438f2ce642194b6051.jpg" | |
| 		} | |
| 	}, | |
| 	onShareAppMessage() { | |
| 		const pages = getCurrentPages(); // 获取加载的页面 | |
| 		const view = pages[pages.length - 1]; // 获取当前页面的对象 | |
| 		let url = ''; | |
| 		let shareParam = {} | |
| 		console.log(view) | |
| 		if (view.$page.fullPath) { | |
| 			url = view.options.fullPath; | |
| 		} else { | |
| 			url = uni.getStorageSync('webUrl'); | |
| 		} | |
| 		if (view.data && view.data.shareParam) { | |
| 			shareParam = view.data.shareParam | |
| 		} | |
| 		console.log(111,url,`${view.route}?url=${url}`) | |
| 		return { | |
| 			title: '时味苏州', // 分享的名称 | |
| 			path: `${view.$page.fullPath}`, | |
| 			// imageUrl: "https://static.ticket.sz-trip.com/uploads/20250818/5ea2c18a15db8a438f2ce642194b6051.jpg", | |
| 			mpId: 'wx699ed131345cf8dd', // 此处配置微信小程序的 AppId | |
| 			...shareParam | |
| 		}; | |
| 	} | |
| } |