pouchdb.find不是函数 [英] pouchdb.find is not a function

查看:79
本文介绍了pouchdb.find不是函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用create-react-app创建的react应用。因此,请使用与create-react-app捆绑在一起的webpack。
我必须使用Pouchdb的find(),但是我做不到。其他Pouch功能运行正常,但发现插件未连接到Pouch。

I have an react app created using create-react-app. So using webpack which is bundled with create-react-app. I have to use find() of Pouchdb, which I am unable to do. Other Pouch functionality is working fine but find plugin is not getting attached to Pouch.

import PouchDB from 'pouchdb';
PouchDB.plugin(require('pouchdb-find'));

package.json中的版本:

Versions in package.json :

"pouchdb": "^6.4.1",
"pouchdb-browser": "^6.4.1",
"pouchdb-find": "^6.4.1"

有人知道如何解决此问题。
预先感谢。

Do anyone have Idea how to fix this. Thanks in advance.

推荐答案

我找到了解决此问题的方法。希望对其他人有帮助

I found the way to solve this problem. Hope it will help others

import PouchDB from 'pouchdb';
import PouchdbFind from 'pouchdb-find';

export class PouchService {
    constructor() {
        PouchDB.plugin(PouchdbFind);
    }
}

在find()之后,它被包含在PouchDB对象中。

After this find() gets included in PouchDB objects.

这篇关于pouchdb.find不是函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆