uni app 微信小程序分享
记录uni app 微信小程序的分享功能
分享只需要将注意按钮的open-type设置为share
另外取消button的样式
button:after {
border: none;
}
<button open-type="share">
<image src="../../static/link.png" ></image>
</button>
其次就是定义分享的onShareAppMessage
主要是title 分享的名字
path 分享的路径 可以带上参数 方便解析
imageUrl 分享图片的地址
onShareAppMessage(res) {
return {
title: `来自的分享`,
path: `/pages/index/index`,
imageUrl: 地址
}
}
菜鸟前端 多多指正