Small micro-channel parameter settings objects

 By the way: small micro-channel program is not directly connected to the database, so I want to get the real address of the database is to be achieved through access interface.

1. Normal settings small micro-channel parameters:

 data: {
      abc: "",
      qwe: "",
  },
  onLoad: function (options) {
    var self = this
        self.setData({
          abc: options.a
          qwe: options.b
        })
      }
   

2. Set the object parameters

 data: {
info:{
      abc: ""
}
  },
  onLoad: function (options) {
    var self = this
    var abcd = 'info.abc'
        self.setData({
          [abcd]: options.a
        })
      }
   

You can also write directly to:

 data: {
info:{
      abc: ""
}
  },
  onLoad: function (options) {
    var self = this
        self.setData({
          'info.abc': options.a
        })
      }
   

 

Guess you like

Origin blog.csdn.net/qq_39404258/article/details/90291465