关于小程序实现半屏跳转功能

597 阅读1分钟

image.png 1.写个测试网页,添加个按钮,给按钮添加个绑定事件
<button bindtap="goOther">点击跳转小程序</button>

image.png
2.写js代码

image.png

goOther(){ const platform = wx.getSystemInfoSync().platform if (platform !== 'android') { wx.showLoading({ title: '打开小程序中', mask: true }) } const token = wx.getStorageSync('token') wx.openEmbeddedMiniProgram({ // 要跳转的小程序的appid appId: 'xxxx', // envVersion: __ENV__ !== 'production' ? 'trial' : 'release', // path: /pages/index/index?id=xxx, success: () => {}, fail: (error) => { console.log('跳转小程序失败', error) }, complete: () => { wx.hideLoading() } }) },
3.最重要的一步:
打开当前小程序的公众号平台,在设置-->第三方设置-->最下方

image.png 在这里添加需要被吊起的小程序,然后需要在被吊起的小程序里面这个位置,点击我授权的里面同意哦。 4.在app.json中添加
"embeddedAppIdList": ["appid(需要被吊起的appid)"] 快去试试吧~
原文:developers.weixin.qq.com/miniprogram…