获取当前绑定账户的appid
uniapp
console.log('appid',uni.getAccountInfoSync().miniProgram.appId)
原生
console.log(111,my.getAccountInfoSync().miniProgram.appId)
组件绑定事件存在默认参数,同时要传参
@FollowLifestyle="FollowLifestyle($event,item)"
js模板字符串的使用
//this.index是变量,this.index = 1`details${this.index}-title`//结果为:details1-title
在html遍历循环点击获取当前对象和索引
获取对象:在绑定事件的标签添加data-item="{{item}}"
获取索引:在绑定事件的标签添加data-index="{{index}}"
html:
{{item.advertTitle}}
js:
onJumpClick(e) { let item = e.currentTarget.dataset.item; let index = e.currentTarget.dataset.index; },
点击按钮弹出生活号
支付宝跳转生活号
const id = obj.extend1 //生活号idmy.ap.navigateToAlipayPage({path: encodeURIComponent(`https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FappId%3D20000042%26publicId%3D${id}`)});
支付宝页面使用链接访问
https://render.alipay.com/p/s/i/?scheme=alipays://platformapi/startapp?appId=2021003147673053&page=pages/conversionCopy/conversionCopy?advertTitle%3DUSD%E6%8D%A2%E7%AE%97%26hotNav%3Dtrue
支付宝小程序搜索页面
let link = `https://render.alipay.com/p/s/i/?scheme=${encodeURIComponent(`alipays://platformapi/startapp?appId=20001003&actionSrc=hometab&keyword=${str}`)}`
h5跳转支付宝搜索
let str = '深圳我爱你' const link = `alipays://platformapi/startapp?appId=20001003&actionSrc=hometab&keyword=${str}` my.ap.navigateToAlipayPage({ path: encodeURIComponent( `https://render.alipay.com/p/s/i/?scheme=${encodeURIComponent(link)}` ) })
支付宝跳转其他小程序
my.navigateToMiniProgram({appId: obj.jumpAppid, //appidpath: obj.jumpPath, //跳转路径extraData: JSON.parse(obj.jumpExtraData), //扩展字段success: (res) => {console.log(res)},fail: (res) => {console.log(res)}});
支付宝嵌套h5链接显示
my.ap.navigateToAlipayPage({// 注意只支持特定前缀的 URL,且需要整体冗余编码path: encodeURIComponent('https://render.alipay.com/p/s/i/?scheme=alipays%3A%2F%2Fplatformapi%2Fstartapp%3FsaId%3D20000067%26url%3D' +encodeURIComponent(obj.jumpWebviewUrl)), //h5路径success: (res) => {console.log('navigateToAlipayPage success', JSON.stringify(res));},fail: (res) => {console.error('navigateToAlipayPage fail', JSON.stringify(res));}});
h5链接转支付宝链接访问
alipays://platformapi/startapp?appId=2021003147673053&page=pages/webview/webview?webViewUrl=http://h5.jiekuanzhushou.com/standby/#/
h5跳转支付宝小程序
https://render.alipay.com/p/s/i/?scheme=alipays://platformapi/startapp?appId=2021003147673053&page=pages/conversionCopy/conversionCopy?advertTitle%3DUSD%E6%8D%A2%E7%AE%97%26hotNav%3Dtrue
来源地址:https://blog.csdn.net/weixin_47586598/article/details/128015663