Commit 7922e901358df9dc648f5a52bda24074d2302e23
1 parent
55405afe
fix: vxe size
Showing
3 changed files
with
18 additions
and
11 deletions
yudao-ui-admin-vue3/src/config/axios/service.ts
| @@ -46,7 +46,7 @@ service.interceptors.request.use( | @@ -46,7 +46,7 @@ service.interceptors.request.use( | ||
| 46 | ;(config as Recordable).headers.Authorization = 'Bearer ' + getAccessToken() // 让每个请求携带自定义token | 46 | ;(config as Recordable).headers.Authorization = 'Bearer ' + getAccessToken() // 让每个请求携带自定义token |
| 47 | } | 47 | } |
| 48 | // 设置租户 | 48 | // 设置租户 |
| 49 | - if (tenantEnable) { | 49 | + if (tenantEnable && tenantEnable === 'true') { |
| 50 | const tenantId = getTenantId() | 50 | const tenantId = getTenantId() |
| 51 | if (tenantId) service.defaults.headers.common['tenant-id'] = tenantId | 51 | if (tenantId) service.defaults.headers.common['tenant-id'] = tenantId |
| 52 | } | 52 | } |
yudao-ui-admin-vue3/src/hooks/web/useCache.ts
| @@ -4,9 +4,9 @@ | @@ -4,9 +4,9 @@ | ||
| 4 | 4 | ||
| 5 | import WebStorageCache from 'web-storage-cache' | 5 | import WebStorageCache from 'web-storage-cache' |
| 6 | 6 | ||
| 7 | -type CacheType = 'sessionStorage' | 'localStorage' | 7 | +type CacheType = 'localStorage' | 'sessionStorage' |
| 8 | 8 | ||
| 9 | -export const useCache = (type: CacheType = 'sessionStorage') => { | 9 | +export const useCache = (type: CacheType = 'localStorage') => { |
| 10 | const wsCache: WebStorageCache = new WebStorageCache({ | 10 | const wsCache: WebStorageCache = new WebStorageCache({ |
| 11 | storage: type | 11 | storage: type |
| 12 | }) | 12 | }) |
yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts
| 1 | import { computed, reactive } from 'vue' | 1 | import { computed, reactive } from 'vue' |
| 2 | -import { VxeGridProps } from 'vxe-table' | 2 | +import { SizeType, VxeGridProps } from 'vxe-table' |
| 3 | import { useAppStore } from '@/store/modules/app' | 3 | import { useAppStore } from '@/store/modules/app' |
| 4 | import { VxeAllSchemas } from './useVxeCrudSchemas' | 4 | import { VxeAllSchemas } from './useVxeCrudSchemas' |
| 5 | import { useI18n } from '@/hooks/web/useI18n' | 5 | import { useI18n } from '@/hooks/web/useI18n' |
| @@ -18,19 +18,26 @@ interface UseVxeGridConfig<T = any> { | @@ -18,19 +18,26 @@ interface UseVxeGridConfig<T = any> { | ||
| 18 | const appStore = useAppStore() | 18 | const appStore = useAppStore() |
| 19 | 19 | ||
| 20 | const currentSize = computed(() => { | 20 | const currentSize = computed(() => { |
| 21 | - if (appStore.getCurrentSize === 'small') { | ||
| 22 | - return 'small' | ||
| 23 | - } else if (appStore.getCurrentSize === 'large') { | ||
| 24 | - return 'mini' | ||
| 25 | - } else { | ||
| 26 | - return 'medium' | 21 | + let resSize: SizeType = 'small' |
| 22 | + const appsize = appStore.getCurrentSize | ||
| 23 | + switch (appsize) { | ||
| 24 | + case 'large': | ||
| 25 | + resSize = 'medium' | ||
| 26 | + break | ||
| 27 | + case 'default': | ||
| 28 | + resSize = 'small' | ||
| 29 | + break | ||
| 30 | + case 'small': | ||
| 31 | + resSize = 'mini' | ||
| 32 | + break | ||
| 27 | } | 33 | } |
| 34 | + return resSize | ||
| 28 | }) | 35 | }) |
| 29 | 36 | ||
| 30 | export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { | 37 | export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { |
| 31 | const gridOptions = reactive<VxeGridProps>({ | 38 | const gridOptions = reactive<VxeGridProps>({ |
| 32 | loading: true, | 39 | loading: true, |
| 33 | - size: currentSize.value, | 40 | + size: currentSize as any, |
| 34 | height: 800, | 41 | height: 800, |
| 35 | rowConfig: { | 42 | rowConfig: { |
| 36 | isCurrent: true, // 当鼠标点击行时,是否要高亮当前行 | 43 | isCurrent: true, // 当鼠标点击行时,是否要高亮当前行 |