Page({
onShareAppMessage() {
const promise = new Promise(resolve => {
setTimeout(() => {
resolve({
title: '自定义转发标题'
})
}, 2000)
})
return {
title: '自定义转发标题',
path: '/page/user?id=123',
promise
}
}
})https://developers.weixin.qq.com/miniprogram/introduction/qrcode.html
你好, 我这里是用的uni-app生成的代码,在onShareAppMessage 中使用promise, 参考官网代码示例,开发者工具和IOS手体验版均未生效,走的是小程序默认的分享数据。
下面是我的代码:
onShareAppMessage(res) {
const promise = Promise((resolve) => {
setTimeout(() => {
resolve({
title: '自定义转发标题',
imageUrl: this.share.imageUrl,
path: this.share.path,
});
}, 1000);
});
return {
title: this.share.title,
path: this.share.path,
imageUrl: this.share.imageUrl,
query: this.share.query,
};
},
new Promise,并且在return中调用
https://developers.weixin.qq.com/s/6vbN1vmE7WAj,写了个代码片段,ok的呀
正如楼上所说,定义的不对,然后也没调用