wx.chooseImage返回的tempFilePaths[0]不能作为临时显示图片的路径吗?

小程序 文章 2022-04-13 14:20 1716 0 全屏看文

AI助手支持GPT4.0

wx.chooseImage返回的tempFilePaths[0]不能作为临时显示图片的路径吗?Can't tempFilePaths[0] returned by wx.chooseImage be used as the path to temporarily display images?

wx.chooseImage返回的tempFilePaths[0]不能作为临时显示图片的路径吗?

wxml文件代码如下:

<image url='{{urlceshi}}'></image>

js文件代码如下:

  data: {     urlceshi:'', }, uploadToCloud() {    var that = this    wx.chooseImage({      count: 1,      sizeType: ['original''compressed'],  //原图、压缩图      sourceType: ['album''camera'],  //图片来源,从相册、相机选择      success (res) {        console.log(res)        that.setData({          urlceshi:res.tempFilePaths[0]        })        console.log(that.data.urlceshi)      }    })  },

根本不显示图片啊,难道只有上传到云,用云的图片路径才能显示吗?

但是我并不想上传到云,太麻烦了,只是想临时显示一下图片而已。

有没有大佬有解决办法的

The wxml file code is as follows: < image url = '{{urlceshi}' > < / Image > JS file code is as follows: data: {urlceshi: '',}, Uploadtocloud() {var} that = this wx.chooseimage ({count: 1, sizetype: ['original ','compressed'], / / original image, compressed image,} sourcetype: ['album ','camera'], / / image source, select {success (RES) {console.log (RES) that.setdata ({urlcash: res.tempfilepaths [0] from photo album and camera         })        console. Log (that. Data. Urlceshi)}})} does not display pictures at all. Can it be displayed only by uploading to the cloud and using the image path of the cloud? But I} don't want to upload to the cloud. It's too troublesome. I just want to temporarily display the picture. Is there a big man who has a solution

回答:

哈罗哈皮:

老铁,这里是src,不是url

Mr.Zhao:

我就不看文档,张三让我看,我也不看

幸福か陪伴:
<image src='{{urlceshi}}'></image>


-EOF-

AI助手支持GPT4.0