首页 > 解决方案 > 如何使用基于类别的 pouchdb 存储数据?

问题描述

我需要在 myapp 中存储数据,例如 userdetails 类别中的 userdetails,模板中的模板数据。我们如何对 pouch db 中的数据进行分类

标签: offlinepouchdb

解决方案


你可以有一些数据库

import Vue from 'vue'
import PouchDB from 'pouchdb'

export default () => {
    const db = {
        dbModel: null,
        dbSlider: null,
        dbBook: null,
        dbContent: null,
        dbSession: null,
        dbTip: null,
        dbLecture: null,
        init() {
            this.dbModel = new PouchDB('hedayat_noor');
            this.dbSlider = new PouchDB('slider');
            this.dbBook = new PouchDB('book');
            this.dbContent = new PouchDB('content');
            this.dbSession = new PouchDB('session');
            this.dbTip = new PouchDB('tip');
            this.dbLecture = new PouchDB('lecture');
        },
    };
    db.init();
    Vue.prototype.$db = db
}

推荐阅读