在处理Skygear JS SDK时,查询是否返回一个数组?
readDummy: function(){
const Test = skygear.Record.extend('test_test');
const Query = new skygear.Query(Test);
skygear.publicDB.query(Query).then((records) => {
console.log(records.constructor === Array); // return false
console.log(JSON.stringify(records[0])); //do display correctly
//{"_id":"test_test/b9633d1a-ff3c-491b-82f3-93c8cefb5313","_access":[{"public":true,"level":"read"}],"content":"Hello World"}
}, (error) => {
console.error(error);
});
},
答案 0 :(得分:3)