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
}
// 设置租户
if (tenantEnable) {
if (tenantEnable && tenantEnable === 'true') {
const tenantId = getTenantId()
if (tenantId) service.defaults.headers.common['tenant-id'] = tenantId
}

View File

@ -4,9 +4,9 @@
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({
storage: type
})

View File

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