fix: 修复管理端前端 lint 与构建问题
- 收敛 easyflow-ui-admin 的 lint、格式和类型问题 - 修正 demo 页面与管理端前端构建失败点 - 验证 pnpm lint 与 pnpm build 均已通过
This commit is contained in:
@@ -84,14 +84,25 @@ const resolvedPrimaryAction = computed(() => {
|
||||
return props.primaryAction;
|
||||
});
|
||||
|
||||
function resolveActionPlacement(
|
||||
action: ActionButton,
|
||||
index: number,
|
||||
): ActionPlacement {
|
||||
if (action.placement) {
|
||||
return action.placement;
|
||||
}
|
||||
if (resolvedPrimaryAction.value) {
|
||||
return 'menu';
|
||||
}
|
||||
return index < 3 ? 'inline' : 'menu';
|
||||
}
|
||||
|
||||
const resolvedActions = computed<ResolvedActionButton[]>(() => {
|
||||
return props.actions
|
||||
.filter((action) => hasPermission(action.permission))
|
||||
.map((action, index) => ({
|
||||
...action,
|
||||
placement:
|
||||
action.placement ||
|
||||
(resolvedPrimaryAction.value ? 'menu' : index < 3 ? 'inline' : 'menu'),
|
||||
placement: resolveActionPlacement(action, index),
|
||||
tone:
|
||||
action.tone ||
|
||||
(action.className?.includes('danger') ? 'danger' : 'default'),
|
||||
@@ -111,8 +122,8 @@ const menuActions = computed(() => {
|
||||
const showFooter = computed(() => {
|
||||
return Boolean(
|
||||
resolvedPrimaryAction.value ||
|
||||
inlineActions.value.length ||
|
||||
menuActions.value.length,
|
||||
inlineActions.value.length > 0 ||
|
||||
menuActions.value.length > 0,
|
||||
);
|
||||
});
|
||||
|
||||
@@ -132,10 +143,8 @@ function handleActionClick(event: Event, action: ActionButton, item: any) {
|
||||
v-for="(item, index) in props.data"
|
||||
:key="item.id ?? index"
|
||||
shadow="never"
|
||||
:class="[
|
||||
'card-item',
|
||||
{ 'card-item--interactive': resolvedPrimaryAction },
|
||||
]"
|
||||
class="card-item"
|
||||
:class="[{ 'card-item--interactive': resolvedPrimaryAction }]"
|
||||
:role="resolvedPrimaryAction ? 'button' : undefined"
|
||||
:tabindex="resolvedPrimaryAction ? 0 : undefined"
|
||||
@click="handlePrimaryAction(item)"
|
||||
@@ -201,7 +210,7 @@ function handleActionClick(event: Event, action: ActionButton, item: any) {
|
||||
</div>
|
||||
|
||||
<div
|
||||
v-if="inlineActions.length || menuActions.length"
|
||||
v-if="inlineActions.length > 0 || menuActions.length > 0"
|
||||
class="card-actions"
|
||||
@click.stop
|
||||
>
|
||||
|
||||
Reference in New Issue
Block a user