小程序 组件监听

作者:zhuge··预计阅读 14 分钟·639 阅读·0 评论
小程序 组件监听

Component({

data: {

      rgb:{

        r:0,g:0,b:0

      },

      fullcolor:'0,0,0'

  },

 observers:{

    'rgb.r,rgb.g,rgb.b':function(r,g,b)

    {

      this.setData({fullcolor:`${r},${g},${b}`})

    },


    'rgb.**':function(obj)

    {

      this.setData({fullcolor:`${obj.r},${obj.g},${obj.b}`})      

    }

  }

}

相关文章

评论

加载中...