关于微信小程序云开发我也是接触不久,所以可能会有一些低级错误,望谅解。我现在打算做一个能上传图片的发帖功能,然后看帖子的时候要能看到每个帖子可能附带的图片,按照网上教程上传图片到云开发的存储中(使用wx.cloud.uploadFile),将返回的路径结果push进数据库集合对应帖子的字段imagelist空集,例如‘imagelist’:[http://tmp/wxfc465a6849644c1f.o6zAJs48V7US_nMxWevh374HXQ4g.FCL7C7Tft3fM51f32aa9df243ceb64dc243c3d7a8803.jpg],在开发者工具能顺利显示每个帖子附带的图片,可在使用开发者工具上的真机检测功能进行手机端检测时(我用的是华为荣耀8X),图片却没有显示,不知道怎么回事,望前辈们替我解惑
请问 问题解决了吗 我现在也遇到这个问题 预览上真机显示不出来
let imagelist = this.data.imagesList;
let filePath = this.data.fP;
let timestamp = Date.parse(new Date());
const cloudPath = timestamp + filePath.match(/\.[^.]+?$/)[0];
wx.cloud.uploadFile({
cloudPath,
filePath,
success: res => {
imagelist = imagelist.concat(res.fileID)
this.is_all_ok()
},
fail: err => {
console.log(err)
},
有报错信息吗?
给 image 标签加个 `binderror` ,看看报错
https://developers.weixin.qq.com/miniprogram/dev/component/image.html