问题遇到的现象和发生背景
怎么可以从本地直接上传多个图片,并且排版成九宫格的
用代码块功能插入代码,请勿粘贴截图
wxml的
<button bindtap="xuanze">选择图片</button>
<view wx:for="{{pics}}">
<image src="{{ima}}" mode="aspectFit" style="margin-top: 10px;" alt=""/>
</view>
js里的
data: {
ima:"https://img2.baidu.com/it/u=3883278396,2797261079&fm=253&fmt=auto&app=138&f=JPEG?w=500&h=281",
},
xuanze(){
var that=this
wx.chooseImage({
count: 3,
success(res){
console.log(res.tempfilePaths)
that.setData({
pics:res.tempFilePaths
})
}
})
},
运行结果及报错内容
只能显示同一张图片
我想要达到的结果
可以直接从本地插入图片,形成九宫格