fix(web-admin): stick category header tools with MpBusinessHeader.

Move expand-all and add into a header actions slot so they remain visible while scrolling.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
wuzilongandCursor committed 2026-10-18 16:40:35 +08:00
1 parent efe7f77a66
commit ef71e842ee
4 files changed
+184 -26

No files matched your search

@@ -1,18 +1,19 @@
<template>
<MpWebviewShell @ready="onShellReady">
<div class="mp-product-page">
<MpBusinessHeader title="产品分类" back-label="返回产品列表" @back="goBack" />
<div class="mp-cat-header-tools">
<button
v-if="flatNodes.length"
class="mp-cat-header-btn"
type="button"
@click="toggleExpandAll"
>
{{ expandAllLabel }}
</button>
<button class="mp-cat-header-btn" type="button" @click="openAdd()">新增</button>
</div>
<MpBusinessHeader title="产品分类" back-label="返回产品列表" @back="goBack">
<template #actions>
<button
v-if="hasExpandableNodes"
class="mp-cat-header-btn"
type="button"
@click="toggleExpandAll"
>
{{ expandAllLabel }}
</button>
<button class="mp-cat-header-btn" type="button" @click="openAdd()">新增</button>
</template>
</MpBusinessHeader>
<div v-if="loading && !tree.length" class="mp-product-loading">
<van-loading vertical>正在加载分类</van-loading>
@@ -284,6 +285,10 @@
return 'success'
}
const hasExpandableNodes = computed(
() => Object.keys(collectExpandIds(tree.value)).length > 0
)
const expandAllLabel = computed(() =>
areAllExpandableExpanded(tree.value, expandedIds.value) ? '全部折叠' : '全部展开'
)
@@ -461,20 +466,6 @@
</script>
<style scoped lang="scss">
.mp-product-page {
position: relative;
}
.mp-cat-header-tools {
position: absolute;
top: calc(8px + env(safe-area-inset-top, 0px));
right: 12px;
z-index: 60;
display: flex;
gap: 8px;
align-items: center;
}
.mp-cat-header-btn {
height: 32px;
padding: 0 10px;