offline - 如何使用基于类别的 pouchdb 存储数据?
问题描述
我需要在 myapp 中存储数据,例如 userdetails 类别中的 userdetails,模板中的模板数据。我们如何对 pouch db 中的数据进行分类
解决方案
你可以有一些数据库
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
}
推荐阅读
- google-sheets - 谷歌表格中奇怪的“查找”行为
- c# - 使用 LINQ 在集合中查找所需元素 - 不重复
- game-engine - Godot - Input.is_action_just_pressed() 运行两次
- javascript - 被 CORS 策略阻止 请求的资源上不存在“Access-Control-Allow-Origin”标头
- sql-server - SQL查询在应该有数值的连接后返回空值
- r - 我被困在使用“pivot_longer”来重塑这个数据集
- swagger - Swagger中数组对象的对象
- express - 无法连接到托管在 VPS 上的节点服务器
- tinymce - Tinymce - 为标题(H1、H2 等)定义特定的字体
- c++ - RC4加密cpp算法