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"
:color="item.color"
:link = "item.link ? item.link : false"
v-hasPermi="[item.hasPermi]"
@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 }}
</el-button>
<slot></slot>

14
src/utils/disposition/defaultButtons.ts

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

Loading…
Cancel
Save