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