Loading

微信小程序 setData 数组 渲染问题 删除之后的数组渲染不正确

list: [
      { id: 0, mode: 1, src: 'https://s2.yzlcq.cn/images/10070.png', text: '0' },
      { id: 1, mode: 1, src: 'https://s2.yzlcq.cn/images/10070.png', text: '1' },
      { id: 2, mode: 1, src: 'https://s2.yzlcq.cn/images/10070.png', text: '2' }
    ],
onDelete(e) {
    var no = Number(e.currentTarget.dataset.index);
    console.log(no)
    var that = this
    wx.showModal({
      title: '提示',
      content: '您确认删除该图片和描述信息吗?确定将删除图片和描述信息',
      success(res) {
        if (res.confirm) {
          that.data.list.splice(no, 1)
          that.setData({ list: that.data.list })
        }
      }
    })
  }

 

posted @ 2019-07-11 18:48  microestc  阅读(1353)  评论(0编辑  收藏  举报