Skip to content

OperatBtns

适用于表格可下拉操作按钮。

  • 内置权限处理

如何使用

vue
<script setup lang="ts">
const btns = [
  {
    label: '编辑',
    // permission: ['WMS.Function.ShelfManagementEditor', 'WMS.Function.ShelfManagementStatus'],
  },
  {
    label: '审核',
    // permission: 'WMS.Function.BaseLogOperationRecords',
  },
  {
    label: '转移',
  },
  {
    label: '封存',
  },
  {
    label: '禁用',
  },
  {
    label: '下架',
    props: {
      danger: true,
    },
  },
]
</script>

<template>
  <OperatBtns :btns="btns" />
</template>

代码演示

基本使用

<script setup lang="ts">
const btns = [
  {
    label: '编辑',
    // permission: ['WMS.Function.ShelfManagementEditor', 'WMS.Function.ShelfManagementStatus'],
  },
  {
    label: '审核',
    // permission: 'WMS.Function.BaseLogOperationRecords',
  },
  {
    label: '转移',
  },
  {
    label: '封存',
  },
  {
    label: '禁用',
  },
  {
    label: '下架',
    props: {
      danger: true,
    },
  },
]
</script>

<template>
  <div>
    <f-space direction="vertical">
      <OperatBtns :btns="btns" />
      <OperatBtns :btns="btns" :max="4" />
    </f-space>
  </div>
</template>

API

参数说明类型默认值版本
btns按钮组IOperatBtnsProps[]--
max展示数量number2-
size边距number12-
more展开字段string更多-
ts
export interface IOperatBtn {
  label: string
  key?: string
  permission?: string | string[] // 权限模型
  props?: Record<string, any> // AButton props
}

export interface IOperatBtnsProps {
  max?: number
  size?: number // 编剧
  more?: string
  btns: IOperatBtn[]
}