js to assign values directly to properties

First look at the code:

 var settedKey = "searchResult";

         var readyData = {};
          readyData[settedKey] = {
          categoryTitle: "",
          units: units
         }

         that.setData(readyData);

The result obtained is:

There will be a searchResult object in data:

Page({

data:{

searchResult:{

categoryTitle: "",
          units: units

}

}

})

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325989744&siteId=291194637