here is my class
export default class Store extends Parse.Object {
constructor() {
super('Store');
this.product = [];
}
}
and after importing it I do this
let store = new Store();
but the issue is the value of product is not initialized, it is still undefined.
any ideas how to solve this issue? I dont want to initialize after I create the instance, like this
store.set('product', []);
答案 0 :(得分:2)
Found a solution, here is how it will work
export default class Store extends Parse.Object {
constructor() {
super('Store');
this.set('product', []);
}
}
but the docs shows as bellow, which is not working !
class Monster extends Parse.Object {
constructor() {
// Pass the ClassName to the Parse.Object constructor
super('Monster');
// All other initialization
this.sound = 'Rawr';
}
}