加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

小程序同一页面不同按钮转发不同样式

发布时间:2020-12-16 23:40:05 所属栏目:百科 来源:网络整理
导读:wxml页面 button class="share-btn" open-type="share" id="1"/button button class="share-btn" open-type="share" id="2"/button js页面代码 onShareAppMessage: function (res) { var that = this; if (res.from == "button") { if (res.target.id == 1)

wxml页面

<button class="share-btn" open-type="share" id="1"></button>
<button class="share-btn" open-type="share" id="2"></button>


js页面代码

onShareAppMessage: function (res) {
var that = this;
if (res.from == "button") {
if (res.target.id == 1) {
?? return {
?? title: ‘1要分享的标题‘,
????path: ‘/pages/index/index‘,
????success: function (res) {

??}
??}

}
?? if (res.target.id == 2) {
return {
?? title: ‘2要分享的标题‘,
????success: function (res) {

??}
??}
}

}

//默认
else {
return {
?? title: ‘右上角要分享的标题‘,
????success: function (res) {

??}
??}

}
}

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读