修改切换路线是滚动条显示上一个位置

This commit is contained in:
A1300399510 2024-10-23 18:37:59 +08:00
parent e6ee936ffd
commit 7bc9fbffbf
2 changed files with 8 additions and 2 deletions

View File

@ -225,7 +225,7 @@
<div class="distance-info-left">
<div class="distance-info-left-item flexcenter" :class="{ 'pitch': index == academyPitchIndex }" v-for="(item, index) in annexSchoolList" :key="index" @click="selectAcademyIndex(index)">{{ item.alias }}</div>
</div>
<el-scrollbar :style="{ height: 50 * annexSchoolList.length + 'px' }">
<el-scrollbar ref="elscrollbarRef" :style="{ height: 50 * annexSchoolList.length + 'px' }">
<div class="distance-info-right flex1">
<div class="distance-header-box flexacenter">
<div class="flexacenter">
@ -844,11 +844,13 @@ let annexSchoolList = ref([]) // 附近院校数据
let academyPitchIndex = ref(0) //
let targetAcademyPitch = ref({}) //
let specialSchoolDistance = ref(null) // school
const elscrollbarRef = ref(null) //
//
const selectAcademyIndex = index => {
academyPitchIndex.value = index || 0
targetAcademyPitch.value = annexSchoolList.value[academyPitchIndex.value]
elscrollbarRef.value.setScrollTop(0)
}
//

View File

@ -363,7 +363,7 @@
<div class="distance-info-left">
<div class="distance-info-left-item flexcenter" :class="{ 'pitch': index == academyPitchIndex }" v-for="(item, index) in annexSchoolList" :key="index" @click="selectAcademyIndex(index)">{{ item.alias }}</div>
</div>
<el-scrollbar :style="{ height: 50 * annexSchoolList.length + 'px' }">
<el-scrollbar ref="elscrollbarRef" :style="{ height: 50 * annexSchoolList.length + 'px' }">
<div class="distance-info-right flex1">
<div class="distance-header-box flexacenter">
<div class="flexacenter">
@ -1309,13 +1309,17 @@ let annexSchoolList = ref([]) // 附近院校数据
let academyPitchIndex = ref(0) //
let targetAcademyPitch = ref({}) //
let specialSchoolDistance = ref(null) // school
const elscrollbarRef = ref(null) //
//
const selectAcademyIndex = index => {
academyPitchIndex.value = index || 0
targetAcademyPitch.value = annexSchoolList.value[academyPitchIndex.value]
elscrollbarRef.value.setScrollTop(0)
}
//
const selectIndex = id => {
if (!id) id = pitchSchool