mirror of
https://github.com/electron-vite/electron-vite-vue
synced 2025-01-19 11:56:36 +08:00
remove sqlite3 relative code
This commit is contained in:
parent
a6fdb6469b
commit
646c6bd0c4
@ -2,7 +2,6 @@ import { createApp } from 'vue'
|
|||||||
import App from './App.vue'
|
import App from './App.vue'
|
||||||
import ipcRendererSample from './mainModules/ipcRendererSample'
|
import ipcRendererSample from './mainModules/ipcRendererSample'
|
||||||
import fsExample from './mainModules/builtinModuleSample'
|
import fsExample from './mainModules/builtinModuleSample'
|
||||||
import sqliteExample from './mainModules/nodeModulesSample'
|
|
||||||
|
|
||||||
createApp(App)
|
createApp(App)
|
||||||
.mount('#app')
|
.mount('#app')
|
||||||
@ -10,5 +9,4 @@ createApp(App)
|
|||||||
window.removeLoading()
|
window.removeLoading()
|
||||||
ipcRendererSample()
|
ipcRendererSample()
|
||||||
fsExample()
|
fsExample()
|
||||||
sqliteExample()
|
|
||||||
})
|
})
|
||||||
|
@ -1,31 +0,0 @@
|
|||||||
import path from 'path'
|
|
||||||
import { ipcRenderer } from 'electron'
|
|
||||||
import sqlite3 from 'sqlite3'
|
|
||||||
|
|
||||||
const createSqlite3 = (userDataPath: string): Promise<sqlite3.Database> => {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
const dbpath = path.join(userDataPath, 'sqlite3.db')
|
|
||||||
console.log(dbpath)
|
|
||||||
const db = new sqlite3.Database(dbpath, (error) => {
|
|
||||||
if (error) {
|
|
||||||
reject(error)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
resolve(db)
|
|
||||||
})
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
const sqliteExample = () => {
|
|
||||||
ipcRenderer.on('app.getPath', async (_, userDataPath) => {
|
|
||||||
try {
|
|
||||||
const db = await createSqlite3(userDataPath)
|
|
||||||
console.log(db)
|
|
||||||
} catch (error) {
|
|
||||||
console.error(error)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
ipcRenderer.send('app.getPath', 'userData')
|
|
||||||
|
|
||||||
}
|
|
||||||
export default sqliteExample
|
|
Loading…
x
Reference in New Issue
Block a user