首页 > 编程知识 正文

微信公众小程序,小程序公众号定制

时间:2023-05-04 06:04:56 阅读:266358 作者:40

1,需要同一个主体
2,特定场景值才可以显示
使用组件跳转

<view style="z-index: 11;position: absolute;" hidden="{{ officialAccount }}"> <official-account bindload='bindload' binderror="binderror"></official-account></view> officialAccount: true, //公众号关注组件显示 this.data.officialAccount = false; // 显示跳转公众号组件 this.setData({'officialAccount': false});

binderror (e) {
console.log(‘组件加载失败’, e)
wx.showToast({
title: ‘组件加载失败!’+e.detail.errMsg+ e.detail.scene,
icon: ‘none’,
duration: 2500
})
},
bindload(){
wx.showToast({
title: ‘组件加载成功呢的’,
icon: ‘none’,
duration: 2500
})
},

官方文档地址

https://developers.weixin.qq.com/miniprogram/dev/component/official-account.html

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。