fix: vxe size

pull/2/head
xingyu4j 2022-11-10 13:15:55 +08:00
parent 55405afe94
commit 7922e90135
3 changed files with 18 additions and 11 deletions

View File

@ -46,7 +46,7 @@ service.interceptors.request.use(
;(config as Recordable).headers.Authorization = 'Bearer ' + getAccessToken() // 让每个请求携带自定义token ;(config as Recordable).headers.Authorization = 'Bearer ' + getAccessToken() // 让每个请求携带自定义token
} }
// 设置租户 // 设置租户
if (tenantEnable) { if (tenantEnable && tenantEnable === 'true') {
const tenantId = getTenantId() const tenantId = getTenantId()
if (tenantId) service.defaults.headers.common['tenant-id'] = tenantId if (tenantId) service.defaults.headers.common['tenant-id'] = tenantId
} }

View File

@ -4,9 +4,9 @@
import WebStorageCache from 'web-storage-cache' import WebStorageCache from 'web-storage-cache'
type CacheType = 'sessionStorage' | 'localStorage' type CacheType = 'localStorage' | 'sessionStorage'
export const useCache = (type: CacheType = 'sessionStorage') => { export const useCache = (type: CacheType = 'localStorage') => {
const wsCache: WebStorageCache = new WebStorageCache({ const wsCache: WebStorageCache = new WebStorageCache({
storage: type storage: type
}) })

View File

@ -1,5 +1,5 @@
import { computed, reactive } from 'vue' import { computed, reactive } from 'vue'
import { VxeGridProps } from 'vxe-table' import { SizeType, VxeGridProps } from 'vxe-table'
import { useAppStore } from '@/store/modules/app' import { useAppStore } from '@/store/modules/app'
import { VxeAllSchemas } from './useVxeCrudSchemas' import { VxeAllSchemas } from './useVxeCrudSchemas'
import { useI18n } from '@/hooks/web/useI18n' import { useI18n } from '@/hooks/web/useI18n'
@ -18,19 +18,26 @@ interface UseVxeGridConfig<T = any> {
const appStore = useAppStore() const appStore = useAppStore()
const currentSize = computed(() => { const currentSize = computed(() => {
if (appStore.getCurrentSize === 'small') { let resSize: SizeType = 'small'
return 'small' const appsize = appStore.getCurrentSize
} else if (appStore.getCurrentSize === 'large') { switch (appsize) {
return 'mini' case 'large':
} else { resSize = 'medium'
return 'medium' break
case 'default':
resSize = 'small'
break
case 'small':
resSize = 'mini'
break
} }
return resSize
}) })
export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => { export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
const gridOptions = reactive<VxeGridProps>({ const gridOptions = reactive<VxeGridProps>({
loading: true, loading: true,
size: currentSize.value, size: currentSize as any,
height: 800, height: 800,
rowConfig: { rowConfig: {
isCurrent: true, // 当鼠标点击行时,是否要高亮当前行 isCurrent: true, // 当鼠标点击行时,是否要高亮当前行