微信小程序的分享页图片如何自定义呢?

1.先要把open-type设置成share

<button wx:if="{{shareMid == undefined}}" open-type="share" class="save-order">分享</button>

注意:右上角也可进行分享

2.触发 onShareAppMessage 方法

//分享 onShareAppMessage:function () {

                             return {

                                title: this.data.rows.keyword,

                                desc: this.data.rows.linename,

                                path: '/pages/home/home?id='+ this.data.pageId,表示用户点击分享页跳转到的位置

                                imgUrl:自定义图片的地址

                             

} },


 

猜你喜欢

转载自blog.csdn.net/weixin_38245489/article/details/81806090