|
@@ -33,18 +33,32 @@ other.elSvg(app);
|
|
|
|
|
|
app.component('pagination', pagination)
|
|
app.component('pagination', pagination)
|
|
app.use(router)
|
|
app.use(router)
|
|
- .use(store, key)
|
|
|
|
- .use(ElementPlus, { i18n: i18n.global.t })
|
|
|
|
- .use(i18n)
|
|
|
|
- .use(JsonViewer)
|
|
|
|
- .use(VueGridLayout)
|
|
|
|
- .use(VForm3)
|
|
|
|
- // .use(BaiduMap, { ak: 'Kp8XHK81HSF6rfRkYP7OxYKtK8IaG51d', type: 'WebGl', v: '2.0' })
|
|
|
|
- .mount('#app');
|
|
|
|
|
|
+ .use(store, key)
|
|
|
|
+ .use(ElementPlus, { i18n: i18n.global.t })
|
|
|
|
+ .use(i18n)
|
|
|
|
+ .use(JsonViewer)
|
|
|
|
+ .use(VueGridLayout)
|
|
|
|
+ .use(VForm3)
|
|
|
|
+ // .use(BaiduMap, { ak: 'Kp8XHK81HSF6rfRkYP7OxYKtK8IaG51d', type: 'WebGl', v: '2.0' })
|
|
|
|
+ .mount('#app');
|
|
|
|
|
|
// 全局挂载
|
|
// 全局挂载
|
|
app.config.globalProperties.getUpFileUrl = getUpFileUrl
|
|
app.config.globalProperties.getUpFileUrl = getUpFileUrl
|
|
app.config.globalProperties.handleTree = handleTree
|
|
app.config.globalProperties.handleTree = handleTree
|
|
app.config.globalProperties.useDict = useDict
|
|
app.config.globalProperties.useDict = useDict
|
|
app.config.globalProperties.selectDictLabel = selectDictLabel
|
|
app.config.globalProperties.selectDictLabel = selectDictLabel
|
|
-app.config.globalProperties.mittBus = mitt();
|
|
|
|
|
|
+app.config.globalProperties.mittBus = mitt();
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+const matchMedia = window.matchMedia('(prefers-color-scheme: light)')
|
|
|
|
+
|
|
|
|
+matchMedia.addEventListener('change', function () {
|
|
|
|
+ // console.log(`当前的主题是:${this.matches ? 'light' : 'dark'}`)
|
|
|
|
+ setTheme(this.matches)
|
|
|
|
+})
|
|
|
|
+
|
|
|
|
+function setTheme(matches: Boolean) {
|
|
|
|
+ const body = document.documentElement as HTMLElement;
|
|
|
|
+ body.setAttribute('data-theme', matches ? '' : 'dark');
|
|
|
|
+ document.querySelector('html')!.className = matches ? '' : 'dark'
|
|
|
|
+}
|