无法读取未定义的属性“默认" [英] cannot read property 'default' of undefined
本文介绍了无法读取未定义的属性“默认"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在下面的 this.realm =
行上出现此错误.不知道为什么当它被格式化为工厂函数时这段代码有效
Getting this error on the this.realm =
line below. Not sure why as this code worked when it was formatted as a factory function
import Realm from 'realm';
export default function Db() {
this.realm = new Realm({
schema: [Wallet, WalletAddress, WalletTransaction, Log, APIWallet, APITransaction, APIAccount, Configuration],
path: config.db_path
});
logger(2, realm.path);
}
Db.prototype.doOneToMany = function(one, many) {..};
Db.prototype.query = function(model, filter) {..};
Db.prototype.insert = function(model, options) {..};
Db.prototype.del = function(model, obj) {..};
Db.prototype.update = function(obj, options) {..};
Db.prototype.write = function(func) {..};
Db.prototype.close = function() {..};
错误
推荐答案
尝试删除default"关键字,它会正常工作...
Try by removing "default" keyword it will work fine...
export function Db() {
this.realm = new Realm({
schema: [Wallet, WalletAddress, WalletTransaction, Log, APIWallet, APITransaction, APIAccount, Configuration],
path: config.db_path
});
logger(2, realm.path);}
试试这个...
这篇关于无法读取未定义的属性“默认"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文