真机调试 wx.chooseImage获得本地图片,不能正常获得图片数量
发布于 5 年前 作者 lcai 12757 次浏览 来自 官方Issues



代码:

JS:

//index.js

//获取应用实例

const app = getApp()

Page({

data: {

},

choose(){

var that=this

wx.chooseImage({

count: 9,

sizeType: [‘original’, ‘compressed’],

sourceType: [‘album’],

success: (res) => {

console.log(res)

that.setData({

imgList: res.tempFiles

})

}

})

}

})

WXML:

<!–index.wxml–>

图片个数:{{imgList.length}}

<button style=“height:100rpx;background-color: #FEE126;” bindtap=“choose”> 添加图片</button>

<view  class=“Image” wx:for="{{imgList}}" bindtap=‘ViewImage’ data-url="{{imgList[index]}}">

<image class=“Imagecontent1” src=’{{item.path}}’ mode=‘aspectFill’></image>

</view>



真机调试的时候不能正常获取图片个数:{{imgList.length}}


4 回复

js处理在写在页面呢

你好,在最新的Nightly版本是正常的,可下载最新的Nightly版本https://developers.weixin.qq.com/miniprogram/dev/devtools/nightly.html

@官方哥哥姐姐

选了六个,实际有3个?

回到顶部