This commit is contained in:
Lx 2025-04-17 15:38:34 +08:00
parent 15e1a31e7b
commit d40c61efd2
2 changed files with 31 additions and 8 deletions

View File

@ -103,7 +103,7 @@
}
.section_2 {
width: 750rpx;
height: 1020rpx;
// height: 1020rpx;
.list_1 {
width: 618rpx;
height: 112rpx;

View File

@ -35,9 +35,10 @@
src="/static/lanhu_shouye2gai/FigmaDDSSlicePNGc8586e4d9e76802e4b93ae8fb3654b38.png" />
</view>
</view>
<view class="itemContent">
<!-- 使用 scroll-view 包裹 SchoolInfo 组件 -->
<scroll-view class="school-scroll-view" scroll-y :style="{ height: scrollHeight + 'px' }">
<scroll-view class="scroll-view" scroll-y :style="{ height: scrollHeight + 'px' }">
<SchoolInfo style="" v-for="(school, index) in schoolList" :key="index" :schoolInfo="school"
@click="goSchoolDetail(school)" />
</scroll-view>
@ -304,13 +305,34 @@
},
calculateScrollHeight() {
//
/* // 获取屏幕高
const screenHeight = uni.getSystemInfoSync().windowHeight;
//
const topHeight = 490;
//
this.scrollHeight = screenHeight - topHeight;
this.scrollHeight = screenHeight - topHeight; */
const systemInfo = uni.getSystemInfoSync();
const windowHeight = systemInfo.windowHeight;
const rpxToPx = systemInfo.windowWidth / 750;
const topOccupiedHeight = 960 * rpxToPx;
this.scrollHeight = windowHeight - topOccupiedHeight;
},
/* calculateScrollHeight() {
//
const screenHeight = uni.getSystemInfoSync().windowHeight;
// 使
const query = uni.createSelectorQuery().in(this);
query.select('.top_').boundingClientRect(data => {
const topHeight = data ? data.height : 0;
query.select('.section_2').boundingClientRect(data => {
const sectionHeight = data ? data.height : 0;
// rpx ( 1px = 2rpx)
this.scrollHeight = (screenHeight - topHeight - sectionHeight) * 2;
}).exec();
}).exec();
}, */
handleItemClick(item) {
// item.text
@ -414,17 +436,18 @@
// scroll-view
.school-scroll-view {
height: 500rpx; //
/* height: 500rpx; // 设置一个固定高度,根据需要调整 */
overflow-y: auto;
margin-left: 22rpx;
}
.itemContent {
padding: 30rpx 0;
margin-top: 20rpx;
/* padding: 10rpx 0; */
display: flex;
flex-direction: column;
row-gap: 20rpx;
/* margin-bottom: 200rpx; */
/* row-gap: 10rpx; */
margin-bottom: 200rpx;
}
.top_ {