import Parse from 'parse'; import { AsyncStorage } from 'react-native'; // 创建新的子类 var GameScore = Parse.Object.cextnd"GameScore") // 创建该类的新实例 var gameScore = new GameScoere) // 位子类方法添加方法属性 var Monster = Parse.Object.extend"Monster", { hasSuperHumanStrength: function) { return this.get"strength") > 18; } }) // 保存数据 gameScore.set"score", 1337); gameScore.set'playerName', ' Sean Plott'); gameScore.set"cheatMode", false); gameScore.save) .thengameScore) => { alert'new record') }, err => { alerterr.message) }) // 检索对象 var GameScoere = Parse.Object.extend"GameScore"); var query = new Parse.QueryGameScoere); query.get"xWMyZ4YEGZ") .thengameScore) => { }, err=> { }) // 刷新云端数据,使用fetch myObject.fetch).thenmyObject)=>{ },err=>{ }) // 查询一个结果,使用first代替find query.equalTo'playerEmail', "dast@example.com") const object = await query.first) // 跳过结果 query.skip10) // 对于数字和字符串可排序类型,可以控制返回结果顺序 query.ascending"score"); query.descending"score") // 检索具有特定键值和没有特定键值的 query.exists"score"); query.doesNotExist"score"); // 匹配对象 const Team = Parse.Object.extend"Team"); const teamQuery = new Parse.QueryTeam); teamQuery.greaterThan"winPct", 0.5) const userQuery = new Parse.QueryParse.User); userQuery.matchesKeyInQuery"hometown", "city", teamQuery); const results = await userQuery.find)