Browse Source

按钮组件添加按钮权限

master
陈薪名 12 months ago
parent
commit
d759596679
  1. 3
      src/components/XButton/src/ButtonBase.vue
  2. 14
      src/utils/disposition/defaultButtons.ts

3
src/components/XButton/src/ButtonBase.vue

@ -5,9 +5,10 @@
:type="item.type" :type="item.type"
:color="item.color" :color="item.color"
:link = "item.link ? item.link : false" :link = "item.link ? item.link : false"
v-hasPermi="[item.hasPermi]"
@click="buttonBaseClick(item.name,item,$event)" @click="buttonBaseClick(item.name,item,$event)"
> >
<Icon :icon="item.icon" class="mr-1px" /> <Icon v-if="item.icon" :icon="item.icon" class="mr-1px" />
{{ item.label }} {{ item.label }}
</el-button> </el-button>
<slot></slot> <slot></slot>

14
src/utils/disposition/defaultButtons.ts

@ -13,7 +13,8 @@ export function defaultAddBtn(option:any) {
hide: false, hide: false,
type: 'primary', type: 'primary',
icon: 'ep:plus', icon: 'ep:plus',
color: '' color: '',
hasPermi: ''
}) })
} }
@ -25,7 +26,8 @@ export function defaultImportBtn(option:any) {
hide: false, hide: false,
type: 'warning', type: 'warning',
icon: 'ep:upload', icon: 'ep:upload',
color: '' color: '',
hasPermi: ''
}) })
} }
@ -37,7 +39,8 @@ export function defaultExportBtn(option:any) {
hide: false, hide: false,
type: 'success', type: 'success',
icon: 'ep:download', icon: 'ep:download',
color: '' color: '',
hasPermi: ''
}) })
} }
@ -166,9 +169,10 @@ export function mainListEditBtn(option:any) {
label: '编辑', label: '编辑',
name: 'edit', name: 'edit',
hide: false, hide: false,
type: 'warning', type: 'primary',
color: '', color: '',
link: true, // 文本展现按钮 link: true, // 文本展现按钮
hasPermi: ''
}) })
} }
@ -181,6 +185,7 @@ export function mainListDeleteBtn(option:any) {
type: 'danger', type: 'danger',
color: '', color: '',
link: true, // 文本展现按钮 link: true, // 文本展现按钮
hasPermi: ''
}) })
} }
@ -200,6 +205,7 @@ function __defaultBtnOption(option:any,specific:any){
color:option && option.color ? option.color : specific.color, color:option && option.color ? option.color : specific.color,
hide:option && option.hide ? option.hide : specific.hide, hide:option && option.hide ? option.hide : specific.hide,
link:option && option.link ? option.link : specific.link, link:option && option.link ? option.link : specific.link,
hasPermi:option && option.hasPermi ? option.hasPermi : specific.hasPermi,
...option ...option
} }
} }

Loading…
Cancel
Save