diff --git a/frontend/package.json b/frontend/package.json index 7d19112..e01074b 100644 --- a/frontend/package.json +++ b/frontend/package.json @@ -12,6 +12,7 @@ "dependencies": { "@vueuse/core": "^10.7.2", "element-plus": "^2.5.5", + "eruda": "^3.0.1", "pinia": "^2.0.21", "vue": "^3.2.38", "vue-i18n": "^9.2.2", diff --git a/frontend/package.json.md5 b/frontend/package.json.md5 index 29c8212..19e1d45 100644 --- a/frontend/package.json.md5 +++ b/frontend/package.json.md5 @@ -1 +1 @@ -17691e1d827cc40ab9ca3fff6eb7aa05 \ No newline at end of file +7dc8355d48f99175c4067c253750bda0 \ No newline at end of file diff --git a/frontend/src/App.vue b/frontend/src/App.vue index c8d999c..02f775a 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,12 +1,38 @@ diff --git a/frontend/src/main.ts b/frontend/src/main.ts index f83ce0a..fac5fd4 100644 --- a/frontend/src/main.ts +++ b/frontend/src/main.ts @@ -13,8 +13,8 @@ import "./style.scss"; const app = createApp(App); -app.use(ElementPlus); app.use(createPinia()); +app.use(ElementPlus); app.use(router); app.use(i18n); diff --git a/frontend/src/stores/globalConfig.ts b/frontend/src/stores/globalConfig.ts new file mode 100644 index 0000000..8d2a7be --- /dev/null +++ b/frontend/src/stores/globalConfig.ts @@ -0,0 +1,15 @@ +import {defineStore} from "pinia"; +import zhCn from "element-plus/dist/locale/zh-cn.mjs"; +import en from "element-plus/dist/locale/en.mjs"; + +export const useGlobalConfig = defineStore("globalConfig",{ + state:()=>({ + ui: { + locale: zhCn, + supportLocale: { + "zh-Hans": zhCn, + en + } + } + }) +}) diff --git a/frontend/src/utils/debugger/eruda.js b/frontend/src/utils/debugger/eruda.js new file mode 100644 index 0000000..00fb509 --- /dev/null +++ b/frontend/src/utils/debugger/eruda.js @@ -0,0 +1,52 @@ +import eruda from 'eruda' +let isCreated = false +export function switchDebugger(){ + if(!isCreated){ + createDebugger() + } else { + hideDebugger() + destroyDebugger() + } +} +export function showDebugger(){ + if(!isCreated){ + return + } + + eruda.show() +} + +export function hideDebugger(){ + if(!isCreated){ + return + } + + eruda.hide() +} + +export function createDebugger(){ + if(!isCreated){ + isCreated = true + eruda.init({ + useShadowDom: true, + autoScale: true, + + defaults: { + displaySize: 50, + transparency: 1, + theme: 'Atom One Light' + } + }) + } else { + eruda.show() + } +} + +export function destroyDebugger(){ + if(!isCreated){ + return + } + + eruda.destroy() + isCreated = false +} diff --git a/frontend/yarn.lock b/frontend/yarn.lock index 4cfc3a8..cb9339e 100644 --- a/frontend/yarn.lock +++ b/frontend/yarn.lock @@ -1134,6 +1134,11 @@ error-ex@^1.3.1: dependencies: is-arrayish "^0.2.1" +eruda@^3.0.1: + version "3.0.1" + resolved "https://registry.npmmirror.com/eruda/-/eruda-3.0.1.tgz#6c07ae2b3ced54151c6e9b21f9b8da11e6ec988a" + integrity sha512-6q1Xdwga4JTr1mKSW4mzuWSSbmXgqpm/8Wa1QGFGfCWRjC0bCQjbS4u06M1te1moucIS3hBLlbSTPWYH2W0qbQ== + es-abstract@^1.22.1, es-abstract@^1.22.3: version "1.22.4" resolved "https://registry.npmmirror.com/es-abstract/-/es-abstract-1.22.4.tgz#26eb2e7538c3271141f5754d31aabfdb215f27bf"