本文主要是介绍Taro活动列表中,对某一个活动添加分享按钮,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
采用data-留下分享链接的拼接参数
1.在item文件中写按钮 openType=“share”
<ButtonclassName={classes.rowRightShareButton}openType="share"data-share-transfer-id={lastGiftingTransferId}data-share-picture-url={shareUrl}data-share-title={shareTitle}onClick={this.onShareClick}>分享好友</Button></View>
2.onShareClick防止item详情页跳转
private onShareClick(e: ITouchEvent) {e.stopPropagation();}
3.在主页面中添加分享按钮
onShareAppMessage(obj: ShareAppMessageObject) {const dataset = get(obj, 'target.dataset', {});if (!dataset.shareTransferId) {return {};}const shareConfig: ShareAppMessageReturn = {path: `/subpackages/stored-value-card/pages/receive-gift-card/index?id=${dataset.shareTransferId}`,imageUrl: dataset.sharePictureUrl,title: dataset.shareTitle};return shareConfig;}
这篇关于Taro活动列表中,对某一个活动添加分享按钮的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!