fix filter and navbar style

This commit is contained in:
Timi
2026-10-22 01:06:31 +08:00
parent 3fc295acb2
commit 2ba4492579
10 changed files with 145 additions and 696 deletions
+8 -109
View File
@@ -8,48 +8,14 @@
@left-click="$router.back()"
>
<template #right>
<div
class="nav-actions"
v-if="(canShowActionMenu) && pageNavBarActionList.length"
>
<t-popover
v-model:visible="pageNavBarActionVisible"
placement="bottom-right"
:show-arrow="false"
theme="light"
>
<t-button
class="trigger"
variant="text"
:aria-label="'更多操作'"
type="button"
>
<template #icon>
<t-icon name="ellipsis" />
</template>
</t-button>
<template #content>
<div class="menu">
<t-button
v-for="action in pageNavBarActionList"
:key="action.key"
class="menu-item"
variant="text"
type="button"
:theme="action.theme"
:loading="action.loading"
:disabled="action.disabled || action.loading"
@click="handlePageNavBarAction(action)"
>
<template v-if="action.icon" #icon>
<t-icon :name="action.icon" />
</template>
<span v-text="action.text" />
</t-button>
</div>
</template>
</t-popover>
</div>
<t-button
v-if="canCreate"
theme="primary"
variant="text"
size="small"
content="新增"
@click="toCreate"
/>
</template>
</t-navbar>
<main class="page-content scroll list">
@@ -133,7 +99,6 @@
</template>
<script setup lang="ts">
import type { NavBarAction } from "@/types/NavBarAction";
import { BottomPopup } from "timi-tdesign-mobile";
import { type CalendarProps, DialogPlugin, type TDate } from "tdesign-mobile-vue";
import { type PageResult, useUserStore } from "timi-web-api";
@@ -145,14 +110,6 @@ import { getErrorMessage } from "@/utils/error";
import { Message } from "@/utils/message";
import { permissionCodes } from "@/utils/permission";
const pageNavBarActionVisible = ref(false);
const pageNavBarActionList = computed<NavBarAction[]>(() => (unref(actionList) as NavBarAction[]).filter(action => action.visible !== false));
async function handlePageNavBarAction(action: NavBarAction): Promise<void> {
pageNavBarActionVisible.value = false;
await action.action();
}
import StoreDiaryListItem from "@/pages/store/component/StoreDiaryListItem.vue";
defineOptions({
@@ -165,7 +122,6 @@ const userStore = useUserStore();
const currentStoreStore = useCurrentStoreStore();
const canCreate = computed(() => userStore.hasPermissions(permissionCodes.storeDiary.create));
const canDelete = computed(() => userStore.hasPermissions(permissionCodes.storeDiary.delete));
const canShowActionMenu = computed(() => canCreate.value);
// ---------- 日历 ----------
@@ -218,22 +174,6 @@ const calendarFormat = computed<NonNullable<CalendarProps["format"]>>(() => {
};
});
// ---------- 顶部操作 ----------
const actionList = computed<NavBarAction[]>(() => {
if (!canCreate.value) {
return [];
}
return [{
action: toCreate,
theme: "primary",
icon: "add",
key: "create",
text: "新增日记"
}];
});
// ---------- 列表数据 ----------
const page = reactive({
@@ -561,45 +501,4 @@ onMounted(async () => {
}
}
.nav-actions {
--td-popover-padding: 0 .5rem;
width: 6rem;
height: 100%;
display: flex;
align-items: center;
justify-content: flex-end;
:deep(.t-popover__content) { border-radius: .875rem; }
.trigger { padding: 0; }
.menu {
gap: .25rem;
display: grid;
padding: .5rem 0;
min-width: 9rem;
.menu-item {
--td-button-medium-height: 32px;
--td-button-medium-padding-horizontal: 10px;
gap: .25rem;
width: 100%;
font-weight: unset;
justify-content: flex-start;
}
}
}
:global(html.theme-dark) {
.nav-actions {
:deep(.t-popover__content) {
color: #e2e8f0;
background: rgba(30, 41, 59, .98);
}
.menu-item { color: #e2e8f0; }
}
}
</style>