data: {
activeIndex: 0,
tempList: 'fangyi',
data_access_token: '',
data: {
tianqi: '',
wuti_image: '/images/wuti.png',
image: '111',
},
},
transformBase64:function(imgSrc) {
var that = this;
var FileSystemManager = wx.getFileSystemManager(); //创建文件管理器
FileSystemManager.readFile({
filePath: imgSrc,
encoding: 'base64',
success: function(res) {
console.log('文件创建返回值')
console.log(res.data)
// var length = res.data.length;
// console.log(length)
var ssss = res.data
that.setData({
"data.image": ssss //转码图片
})
console.log(that.data.data.image);//BASE64值
}
})
console.log(that.data.data.image);//还是111
},
怎么给data.data.image赋值
var ssss = res.data
let data = that.data.data
data.image = ssss
that.setData({
data: data
})
试试,应该
let newData=that.data.data newData.image=res.data; that.setData({ data:newData })