Browse Source

perf: top action slost

xingyu4j 2 years ago
parent
commit
bb48e93ed2

+ 1 - 1
yudao-ui-admin-vue3/src/hooks/web/useVxeCrudSchemas.ts

@@ -18,7 +18,7 @@ export type VxeCrudSchema = {
   primaryKey?: string // 主键ID
   primaryTitle?: string // 主键标题 默认为序号
   primaryType?: VxeColumnPropTypes.Type // 不填写为数据库编号 null为不显示 还支持 "seq" | "radio" | "checkbox" | "expand" | "html" | null
-  action?: boolean // 是否开启操作栏插槽
+  action?: boolean // 是否开启表格内右侧操作栏插槽
   actionTitle?: string // 操作栏标题 默认为操作
   actionWidth?: string // 操作栏插槽宽度,一般2个字带图标 text 类型按钮 50-70
   columns: VxeCrudColumns[]

+ 5 - 1
yudao-ui-admin-vue3/src/hooks/web/useVxeGrid.ts

@@ -11,6 +11,7 @@ const message = useMessage() // 消息弹窗
 
 interface UseVxeGridConfig<T = any> {
   allSchemas: VxeAllSchemas
+  topActionSlots?: boolean // 是否开启表格内顶部操作栏插槽
   treeConfig?: VxeTablePropTypes.TreeConfig
   getListApi: (option: any) => Promise<T>
   deleteApi?: (option: any) => Promise<T>
@@ -51,7 +52,10 @@ export const useVxeGrid = <T = any>(config?: UseVxeGridConfig<T>) => {
       isHover: true // 当鼠标移到行时,是否要高亮当前行
     },
     toolbarConfig: {
-      slots: { buttons: 'toolbar_buttons' }
+      slots:
+        !config?.topActionSlots && config?.topActionSlots != false
+          ? { buttons: 'toolbar_buttons' }
+          : {}
     },
     printConfig: {
       columns: config?.allSchemas.printSchema

+ 1 - 0
yudao-ui-admin-vue3/src/views/system/oauth2/token/index.vue

@@ -41,6 +41,7 @@ const message = useMessage() // 消息弹窗
 const xGrid = ref<VxeGridInstance>() // 列表 Grid Ref
 const { gridOptions, getList } = useVxeGrid<TokenApi.OAuth2TokenVO>({
   allSchemas: allSchemas,
+  topActionSlots: false,
   getListApi: TokenApi.getAccessTokenPageApi
 })