【功能完善】小程序支持转发到朋友圈
							parent
							
								
									f98b1a2bea
								
							
						
					
					
						commit
						4c4134389e
					
				|  | @ -60,12 +60,11 @@ | ||||||
|   /** |   /** | ||||||
|    * 模板组件 - 提供页面公共组件,属性,方法 |    * 模板组件 - 提供页面公共组件,属性,方法 | ||||||
|    */ |    */ | ||||||
|   import { computed, reactive, ref } from 'vue'; |   import { computed } from 'vue'; | ||||||
|   import sheep from '@/sheep'; |   import sheep from '@/sheep'; | ||||||
|   import { isEmpty } from 'lodash-es'; |   import { isEmpty } from 'lodash-es'; | ||||||
|   import { onShow } from '@dcloudio/uni-app'; |  | ||||||
|   // #ifdef MP-WEIXIN |   // #ifdef MP-WEIXIN | ||||||
|   import { onShareAppMessage } from '@dcloudio/uni-app'; |   import { onShareAppMessage, onShareTimeline, onShow } from '@dcloudio/uni-app'; | ||||||
|   // #endif |   // #endif | ||||||
| 
 | 
 | ||||||
|   const props = defineProps({ |   const props = defineProps({ | ||||||
|  | @ -191,7 +190,11 @@ | ||||||
|   }); |   }); | ||||||
| 
 | 
 | ||||||
|   // #ifdef MP-WEIXIN |   // #ifdef MP-WEIXIN | ||||||
|   // 微信小程序分享 |   uni.showShareMenu({ | ||||||
|  |     withShareTicket: true, | ||||||
|  |     menus: ['shareAppMessage', 'shareTimeline'], | ||||||
|  |   }); | ||||||
|  |   // 微信小程序分享好友 | ||||||
|   onShareAppMessage(() => { |   onShareAppMessage(() => { | ||||||
|     return { |     return { | ||||||
|       title: shareInfo.value.title, |       title: shareInfo.value.title, | ||||||
|  | @ -199,6 +202,14 @@ | ||||||
|       imageUrl: shareInfo.value.image, |       imageUrl: shareInfo.value.image, | ||||||
|     }; |     }; | ||||||
|   }); |   }); | ||||||
|  |   // 微信小程序分享朋友圈 | ||||||
|  |   onShareTimeline(() => { | ||||||
|  |     return { | ||||||
|  |       title: shareInfo.value.title, | ||||||
|  |       query: shareInfo.value.path, | ||||||
|  |       imageUrl: shareInfo.value.image, | ||||||
|  |     }; | ||||||
|  |   }); | ||||||
|   // #endif |   // #endif | ||||||
| 
 | 
 | ||||||
|   onShow(() => { |   onShow(() => { | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue
	
	 puhui999
						puhui999