收藏
回答

wxs计算后的节点属性经数据路径更新后更新失败

框架类型 问题类型 终端类型 微信版本 基础库版本
小程序 Bug 微信iOS客户端 7.0.12 2.11.0
Page({
  updateByPath(e) {
    console.log('by path:',JSON.stringify(e.currentTarget.dataset))
    this.setData({
      'style.count': ++this.data.style.count
    })
  },
  updateByObject(e) {
    console.log('by object:',JSON.stringify(e.currentTarget.dataset))
    this.setData({
      'style': {
        count: ++this.data.style.count
      }
    })
  },
  data: {
    style: {
      count: 1
    }
  }
})

u

输出日志

by path: {"styleObj":{"count":1},"styleStr":"{\"count\":1}"}

by path: {"styleObj":{"count":2},"styleStr":"{\"count\":1}"}

by path: {"styleObj":{"count":3},"styleStr":"{\"count\":1}"}

by path: {"styleObj":{"count":4},"styleStr":"{\"count\":1}"}

by path: {"styleObj":{"count":5},"styleStr":"{\"count\":1}"}

by path: {"styleObj":{"count":6},"styleStr":"{\"count\":1}"}

## by object

by object: {"styleObj":{"count":7},"styleStr":"{\"count\":1}"}

by object: {"styleObj":{"count":8},"styleStr":"{\"count\":8}"}

by object: {"styleObj":{"count":9},"styleStr":"{\"count\":9}"}

by object: {"styleObj":{"count":10},"styleStr":"{\"count\":10}"}

by object: {"styleObj":{"count":11},"styleStr":"{\"count\":11}"}

回答关注问题邀请回答
收藏
登录 后发表内容
问题标签