SQLITE 数据库优化,创建时机调整

This commit is contained in:
2022-02-24 17:51:59 +08:00
parent 90584f1101
commit e0185e589d
5 changed files with 59 additions and 46 deletions

32
main.js
View File

@@ -10,15 +10,16 @@ import Vue from 'vue'
import store from './store'
import uView from 'uview-ui'
import filters from './utils/filters.js'
import {
usqlite
} from '@/uni_modules/onemue-USQLite/js_sdk/usqlite.js'
import model from '@/utils/im/models.js'
import {
router,
RouterMount
} from 'router'
import {
usqlite
} from '@/uni_modules/onemue-USQLite/js_sdk/usqlite.js'
import {
contactModel
} from '@/utils/im/models.js'
Object.keys(filters).forEach(key => {
Vue.filter(key, filters[key])
@@ -29,13 +30,20 @@ Vue.use(router)
Vue.config.productionTip = false
Vue.prototype.$store = store
uni.$sql = usqlite
uni.model = model
uni.$sql.connect({
name: 'zh-health',// 数据库名称
path:'_doc/health.db', // 路径
})
usqlite.connect({
name: 'zh-health', // 数据库名称
path: '_doc/health.db', // 路径
}, (err, res) => {
uni.getStorage({
key: 'FIRST_RUN',
fail: () => {
contactModel.create((err, res) => {
console.error('SQLITE 创建表格', err, res)
})
}
})
})
App.mpType = 'app'
const app = new Vue({