|
@ -1,5 +1,21 @@ |
|
|
import { name, version } from '@/config'; |
|
|
import { name, version } from '@/config'; |
|
|
|
|
|
|
|
|
|
|
|
// 创建表
|
|
|
|
|
|
const createTable = (Vue, db) => { |
|
|
|
|
|
// projects项目表
|
|
|
|
|
|
Vue.prototype.$db.projects = db.createObjectStore('projects', { keyPath: 'id' }); |
|
|
|
|
|
// roles 角色表
|
|
|
|
|
|
Vue.prototype.$db.roles = db.createObjectStore('roles', { keyPath: 'id' }); |
|
|
|
|
|
// plan_tasks 定期任务
|
|
|
|
|
|
Vue.prototype.$db.plan_tasks = db.createObjectStore('plan_tasks', { keyPath: 'id' }); |
|
|
|
|
|
// fixed_tasks 固定全局任务
|
|
|
|
|
|
Vue.prototype.$db.fixed_tasks = db.createObjectStore('fixed_tasks', { keyPath: 'id' }); |
|
|
|
|
|
// variable_tasks 可变全局任务
|
|
|
|
|
|
Vue.prototype.$db.variable_tasks = db.createObjectStore('variable_tasks', { keyPath: 'id' }); |
|
|
|
|
|
// plugins 插件表
|
|
|
|
|
|
Vue.prototype.$db.plugins = db.createObjectStore('plugins', { keyPath: 'id' }); |
|
|
|
|
|
}; |
|
|
|
|
|
|
|
|
const install = Vue => { |
|
|
const install = Vue => { |
|
|
Vue.prototype.$db.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; |
|
|
Vue.prototype.$db.indexedDB = window.indexedDB || window.mozIndexedDB || window.webkitIndexedDB || window.msIndexedDB; |
|
|
const request = window.indexedDB.open(name, version); // IDBRequest 对象
|
|
|
const request = window.indexedDB.open(name, version); // IDBRequest 对象
|
|
@ -10,19 +26,7 @@ const install = Vue => { |
|
|
request.onupgradeneeded = event => { |
|
|
request.onupgradeneeded = event => { |
|
|
Vue.prototype.$db.db = event.target.result; |
|
|
Vue.prototype.$db.db = event.target.result; |
|
|
// 创建表
|
|
|
// 创建表
|
|
|
// user表
|
|
|
createTable(Vue, Vue.prototype.$db.db); |
|
|
|
|
|
|
|
|
// projects项目表
|
|
|
|
|
|
|
|
|
|
|
|
// roles 角色表
|
|
|
|
|
|
|
|
|
|
|
|
// plan_tasks 定期任务
|
|
|
|
|
|
|
|
|
|
|
|
// fixed_tasks 固定全局任务
|
|
|
|
|
|
|
|
|
|
|
|
// variable_tasks 可变全局任务
|
|
|
|
|
|
|
|
|
|
|
|
// plugins 插件表
|
|
|
|
|
|
}; |
|
|
}; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|