|
@@ -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, // 当鼠标点击行时,是否要高亮当前行
|