Skip to content

Commit ef3b5a3

Browse files
author
Taois
committed
feat:搜索界面不再出现外层滚动条
1 parent e466021 commit ef3b5a3

File tree

2 files changed

+47
-20
lines changed

2 files changed

+47
-20
lines changed

dashboard/src/components/Layout.vue

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757

5858
<!-- 主内容区域 -->
5959
<div class="main-content" :class="{ 'sider-collapsed': siderCollapsed }">
60-
<div class="content-wrapper">
60+
<div class="content-wrapper" :class="{ 'search-page': isSearchPage }">
6161
<slot></slot> <!-- 插槽,用于插入页面内容 -->
6262
</div>
6363

@@ -71,7 +71,7 @@
7171
</template>
7272

7373
<script>
74-
import { defineComponent, ref, watch } from 'vue';
74+
import { defineComponent, ref, watch, computed } from 'vue';
7575
import { useRoute } from 'vue-router';
7676
import { Message } from '@arco-design/web-vue';
7777
import {
@@ -99,6 +99,11 @@ export default defineComponent({
9999
const route = useRoute();
100100
const paginationStore = usePaginationStore();
101101
102+
// 检测是否为搜索页面
103+
const isSearchPage = computed(() => {
104+
return route.path === '/search' || route.name === 'SearchAggregation';
105+
});
106+
102107
const siderCollapsed = ref(false);
103108
const menuItems = ref([
104109
{id: 1, name: '主页', icon: 'icon-zhuye', route: '/'},
@@ -137,7 +142,8 @@ export default defineComponent({
137142
logoSrc,
138143
logoDesc,
139144
onClickMenuItem,
140-
onSiderCollapse
145+
onSiderCollapse,
146+
isSearchPage
141147
};
142148
}
143149
});
@@ -211,6 +217,12 @@ export default defineComponent({
211217
background: var(--color-bg-3);
212218
}
213219
220+
/* 搜索页面的内容包装器 - 移除滚动,让内部组件自己控制 */
221+
.content-wrapper.search-page {
222+
overflow: hidden;
223+
padding: 0; /* 移除padding,让搜索页面完全控制布局 */
224+
}
225+
214226
/* 固定的底部 */
215227
.fixed-footer {
216228
height: 48px;

dashboard/src/views/SearchAggregation.vue

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -164,20 +164,20 @@
164164
</div>
165165
</div>
166166
</div>
167-
168-
<!-- 分页 -->
169-
<div v-if="totalPages > 1" class="pagination-container">
170-
<a-pagination
171-
v-model:current="currentPage"
172-
:total="searchResults[activeSource].length"
173-
:page-size="pageSize"
174-
:show-total="true"
175-
:show-jumper="true"
176-
:show-size-changer="true"
177-
@change="onPageChange"
178-
@page-size-change="onPageSizeChange"
179-
/>
180-
</div>
167+
</div>
168+
169+
<!-- 分页 -->
170+
<div v-if="activeSource && searchResults[activeSource] && totalPages > 1" class="pagination-container">
171+
<a-pagination
172+
v-model:current="currentPage"
173+
:total="searchResults[activeSource].length"
174+
:page-size="pageSize"
175+
:show-total="true"
176+
:show-jumper="true"
177+
:show-size-changer="true"
178+
@change="onPageChange"
179+
@page-size-change="onPageSizeChange"
180+
/>
181181
</div>
182182

183183
<!-- 加载状态 -->
@@ -808,7 +808,7 @@ export default defineComponent({
808808
809809
/* 搜索结果样式 */
810810
.search-results {
811-
height: 100%;
811+
height: calc(100vh - 112px); /* 减去顶部导航(64px)和底部(48px)的高度 */
812812
overflow: hidden;
813813
}
814814
@@ -824,6 +824,7 @@ export default defineComponent({
824824
border-right: 1px solid var(--color-border-2);
825825
display: flex;
826826
flex-direction: column;
827+
height: 100%;
827828
}
828829
829830
.sources-header {
@@ -832,6 +833,11 @@ export default defineComponent({
832833
gap: 8px;
833834
padding: 16px 20px;
834835
border-bottom: 1px solid var(--color-border-2);
836+
background: var(--color-bg-2);
837+
position: sticky;
838+
top: 0;
839+
z-index: 10;
840+
flex-shrink: 0;
835841
}
836842
837843
.sources-header h4 {
@@ -850,6 +856,7 @@ export default defineComponent({
850856
flex: 1;
851857
overflow-y: auto;
852858
padding: 8px;
859+
height: 0; /* 强制flex子元素计算高度 */
853860
}
854861
855862
.source-item {
@@ -910,13 +917,13 @@ export default defineComponent({
910917
display: flex;
911918
flex-direction: column;
912919
overflow: hidden;
920+
height: 100%;
913921
}
914922
915923
.results-list {
916-
flex: 1;
917924
display: flex;
918925
flex-direction: column;
919-
overflow: hidden;
926+
height: 100%;
920927
}
921928
922929
.results-header {
@@ -925,6 +932,11 @@ export default defineComponent({
925932
justify-content: space-between;
926933
padding: 16px 20px;
927934
border-bottom: 1px solid var(--color-border-2);
935+
background: var(--color-bg-1);
936+
position: sticky;
937+
top: 0;
938+
z-index: 10;
939+
flex-shrink: 0;
928940
}
929941
930942
.results-header h4 {
@@ -946,6 +958,7 @@ export default defineComponent({
946958
display: grid;
947959
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
948960
gap: 20px;
961+
height: 0; /* 强制flex子元素计算高度 */
949962
}
950963
951964
.video-card {
@@ -1040,6 +1053,8 @@ export default defineComponent({
10401053
border-top: 1px solid var(--color-border-2);
10411054
display: flex;
10421055
justify-content: center;
1056+
background: var(--color-bg-1);
1057+
flex-shrink: 0;
10431058
}
10441059
10451060
/* 状态样式 */

0 commit comments

Comments
 (0)