我在查找位置,因为Parse.query的结果只是id,我还有其他列:(
查找响应:
[{"_objCount":0,"className":"DivorceCase","id":"8Ab15ASBX3"}]
实际代码:
// Your corresponding keys
Parse.initialize("xxx", "xxx");
// For back4app applications
Parse.serverURL = 'https://parseapi.back4app.com'
var app = new Vue({
el: "#AttorneyCases",
data: {
DivorceCase :{},
},
mounted:function(){
new Parse.Query("DivorceCase").descending("createdAt").find()
.then((DivorceCaseResponse) => {
this.DivorceCase = DivorceCaseResponse;
})
}
})
答案 0 :(得分:2)
答案 1 :(得分:1)
谢谢,纳塔利克!
最终代码是:
`mounted:function(){
var Case = Parse.Object.extend("DivorceCase");
var query = new Parse.Query(Case);
query.find()
.then((Ids) => {
Ids.forEach(element => {
var Case = Parse.Object.extend("DivorceCase");
var query = new Parse.Query(Case);
query.get(element.id)
.then((DivorceCaseResponse) => {
// The object was retrieved successfully.
this.DivorceCases.push(DivorceCaseResponse.get("BasicInfo"));
},
(e) => {
// The object was not retrieved successfully.
// error is a Parse.Error with an error code and message.
swal({
position: 'center',
type: 'error',
title: e.message,
customClass: 'swal-wide'
})
});
});
},
(e) => {
// The object was not retrieved successfully.
// error is a Parse.Error with an error code and message.
swal({
position: 'center',
type: 'error',
title: e.message,
customClass: 'swal-wide'
})
});
}`