-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9783871
commit b10e42b
Showing
12 changed files
with
13,051 additions
and
534 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,35 @@ | ||
import './assets/main.css' | ||
import "./assets/main.css"; | ||
|
||
import { createApp } from 'vue' | ||
import { createPinia } from 'pinia' | ||
import { createApp } from "vue"; | ||
import { createPinia } from "pinia"; | ||
|
||
import App from './App.vue' | ||
import router from './router' | ||
import App from "./App.vue"; | ||
import router from "./router"; | ||
|
||
import ElementPlus from 'element-plus' | ||
import 'element-plus/dist/index.css' | ||
import ElementPlus from "element-plus"; | ||
import "element-plus/dist/index.css"; | ||
import { useErrorStore } from "./stores/error"; | ||
|
||
const app = createApp(App) | ||
const app = createApp(App); | ||
|
||
app.use(createPinia()) | ||
app.use(router) | ||
app.use(router); | ||
|
||
app.use(ElementPlus) | ||
app.use(ElementPlus); | ||
|
||
app.use(createPinia()); | ||
|
||
app.mount("#app"); | ||
|
||
// store必须写在pinia的最下面 | ||
let { addError } = useErrorStore(); | ||
|
||
// 全局错误处理 | ||
app.config.errorHandler = (err, instance, info) => { | ||
alert(info) | ||
console.table([{err, instance, info}]) | ||
} | ||
console.table([{ err, instance, info }]); | ||
addError(err); | ||
}; | ||
|
||
app.config.globalProperties.$globalErrorHandler = (err, instance, info) => { | ||
alert(info) | ||
console.table([{err, instance, info}]) | ||
} | ||
|
||
app.mount('#app') | ||
addError(err); | ||
console.table([{ err, instance, info }]); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { | ||
ref, | ||
computed, | ||
watch, | ||
reactive, | ||
unref, | ||
toRaw, | ||
toRefs, | ||
watchEffect, | ||
} from "vue"; | ||
import { defineStore, storeToRefs } from "pinia"; | ||
|
||
// 本store,用处在于获取、设置基础信息数据 | ||
export const useErrorStore = defineStore("error", () => { | ||
let errorList = ref([]); | ||
let errorListCache = ref([]); | ||
|
||
watch(() => errorList.value, (n, o) => { | ||
console.log('监听dexie错误', n, o) | ||
// 此处弹出错误弹框 | ||
}) | ||
|
||
function addError(err) { | ||
console.log('hhhhh') | ||
errorList.value = errorList.value.concat(err); | ||
errorListCache.value = errorList.value.concat(err); | ||
} | ||
|
||
function clearError() { | ||
errorList.value = []; | ||
} | ||
|
||
return { | ||
errorList, | ||
errorListCache, | ||
addError, | ||
clearError, | ||
}; | ||
}); |
Oops, something went wrong.