diff --git a/src/components/SizeSelect/index.vue b/src/components/SizeSelect/index.vue
new file mode 100644
index 00000000..aaa643b0
--- /dev/null
+++ b/src/components/SizeSelect/index.vue
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+ {{ item.label }}
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/src/main.ts b/src/main.ts
index 778e8ece..0dff71dd 100644
--- a/src/main.ts
+++ b/src/main.ts
@@ -2,10 +2,11 @@ import {createApp, Directive} from 'vue'
import App from './App.vue'
import router from "./router";
import '@/styles/index.scss'
-import { store } from "./store";
+import {store} from "@/store";
import ElementPlus from 'element-plus'
import 'element-plus/theme-chalk/index.css'
import locale from 'element-plus/lib/locale/lang/zh-cn'
+import {Local} from "@/utils/storage";
import 'virtual:svg-icons-register';
// @see https://blog.csdn.net/qq_37213281/article/details/121422027
@@ -19,6 +20,8 @@ const app = createApp(App)
// 自定义指令
import * as directive from "@/directive";
+
+
Object.keys(directive).forEach(key => {
app.directive(key, (directive as { [key: string]: Directive })[key]);
});
@@ -30,8 +33,9 @@ for (let iconName in ElIconModules) {
// 全局方法
app.config.globalProperties.$listDictsByCode = listDictsByCode
+
app.component('Pagination', Pagination) // 全局组件
- .use(store)
+ .use(store)
.use(router)
- .use(ElementPlus, {locale})
+ .use(ElementPlus, {locale: locale, size: Local.get('size')||'small'})
.mount('#app')
diff --git a/src/store/modules/app.ts b/src/store/modules/app.ts
index c2ba1519..a0df8aaa 100644
--- a/src/store/modules/app.ts
+++ b/src/store/modules/app.ts
@@ -1,21 +1,21 @@
import {AppState} from "@/store/interface";
import {Local} from "@/utils/storage";
-import { store } from "@/store";
-import { defineStore } from "pinia";
+import {store} from "@/store";
+import {defineStore} from "pinia";
export const useAppStore = defineStore({
id: "app",
- state: ():AppState=>({
+ state: (): AppState => ({
device: 'desktop',
sidebar: {
opened: Local.get('sidebarStatus') ? !!+Local.get('sidebarStatus') : true,
withoutAnimation: false
},
- language:'zh',
- size:'medium'
+ language: 'zh',
+ size: Local.get('size')||'default'
}),
actions: {
- toggleSidebar() {
+ toggleSidebar() {
this.sidebar.opened = !this.sidebar.opened
this.sidebar.withoutAnimation = false
if (this.sidebar.opened) {
@@ -24,16 +24,21 @@ export const useAppStore = defineStore({
Local.set('sidebarStatus', 0)
}
},
- closeSideBar ( withoutAnimation:any) {
+ closeSideBar(withoutAnimation: any) {
Local.set('sidebarStatus', 0)
this.sidebar.opened = false
this.sidebar.withoutAnimation = withoutAnimation
},
- toggleDevice( device:any) {
+ toggleDevice(device: string) {
this.device = device
+ },
+ setSize(size: string) {
+ this.size = size
+ Local.set('size', size)
}
}
})
+
export function useAppStoreHook() {
return useAppStore(store);
}
diff --git a/src/store/modules/tagsView.ts b/src/store/modules/tagsView.ts
index ef045c04..c9213259 100644
--- a/src/store/modules/tagsView.ts
+++ b/src/store/modules/tagsView.ts
@@ -2,7 +2,7 @@ import {defineStore} from "pinia";
import {store} from "@/store";
import {TagsViewState} from "@/store/interface";
-const tagsViewStore = defineStore({
+const useTagsViewStore = defineStore({
id: "tagsView",
state: (): TagsViewState => ({
visitedViews: [],
@@ -174,7 +174,7 @@ const tagsViewStore = defineStore({
})
-export function tagsViewStoreHook() {
- return tagsViewStore(store);
+export function useTagsViewStoreHook() {
+ return useTagsViewStore(store);
}