5***@qq.com
5***@qq.com
  • 发布:2023-04-15 11:33
  • 更新:2023-04-17 11:50
  • 阅读:382

微信分享的内容,手机端微信可以打开,电脑端微信打不开。电脑端不执行 await db.collection('bookRecord').where('_id=="' + id + '"').get()

分类:uniCloud

微信小程序<button class="fudongShare" open-type="share" size="mini" type="warn"></button>

onShareAppMessage() {
let that = this;
console.log('onShareAppMessage', 'onShareAppMessage');
const promise = new Promise((resolve) => {
setTimeout(() => {
resolve({
title: '今日' + getApp().globalData.projectName,
});
}, 2000);
});
that.content.dayTime = that.inDate;
that.content.id = that.id;
that.content.title = that.title;
that.content.user_id = that.user_id;
let content = encodeURIComponent(JSON.stringify(that.content));
let param = {
reType: 'comm',
id: this.id,
// content: content
};
// console.log('/pages/index/builderDiary/update', JSON.stringify(param));
return {
// imageUrl: '/static/logo.png',
title: '今日' + getApp().globalData.projectName,
type: 2,
path: '/pages/index/builderDiary/update?param=' + JSON.stringify(param),
};
},

onUnload(options) {
// console.log(options)
var _this = this;
let res = await db.collection('bookRecord').where('_id=="' + id + '"').get()
console.log('res.result.data', res.result.data[0]);
let currentDiary = res.result.data[0];
this.content.detail.html = currentDiary.contentHtml;
this.content.detail.text = currentDiary.content;
this.inDate = currentDiary.inDate;
this.user_id = currentDiary.user_id;
},

2023-04-15 11:33 负责人:无 分享
已邀请:
DCloud_uniCloud_WYQ

DCloud_uniCloud_WYQ

有语法错误,await必须写在async方法内,注意看开发工具控制台应该给你报出来错误了。至于你说的手机上能执行的情况,确定下是不是手机上没有更新成新版

要回复问题请先登录注册