小程序 setdata 只修改逻辑层数据 未更改视图层
如题,编译后,console.log显示的data数据已经修改,但是视图层数据未修改。 [图片] [图片] [图片] js代码: Page({ /** * 页面的初始数据 */ data: { timu: '等等', items: [ { name: '等等' }, { name: '等等' }, { name: '等等' }, { name: '等等' },] }, /** * 生命周期函数--监听页面加载 */ onLoad: function (options) { var that = this; wx.getStorage({ key: 'exam', success: function (res) { var tempA = res.data.A that.setData({ 'items[0]': res.data.A, 'items[1]': res.data.B, 'items[2]': res.data.C, 'items[3]': res.data.D, timu: res.data.title, }) console.log(that.data.items[0]) console.log(that.data.items[1]) console.log(that.data.items[2]) console.log(that.data.items[3]) }, }) }, }) wxml: <view> <view class="contentxt"> <text class="timu">题目:{{timu}}</text> </view> <view class="op"> <radio-group class="radio-group" bindchange="radioChange"> <radio class="radio" wx:for="{{items}}" checked="{{item.checked}}"> <text>{{item.name}}</text> </radio> </radio-group> </view> <button class="btn" bindtap="callFunction">提交</button> </view>