Browse Source

fix: 修复经过店铺滚动问题

pull/12/head
张耀 3 years ago
parent
commit
952dc9ca57
  1. 8
      src/components/PathGroup/PathGroup.vue

8
src/components/PathGroup/PathGroup.vue

@ -16,7 +16,7 @@
</div>
<span class="pass-name">{{ yourpos }} </span>
</li>
<li v-for="(item, idx) of pathshop" :key="item.code" class="pass-item" :class="{ last: playIdx === idx }">
<li v-for="(item, idx) of pathshop" :id="item.shopNum" :key="item.code" class="pass-item" :class="{ last: playIdx === idx }">
<div class="lefts">
<img :src="item.isAddPrefix ? item.logoPath : item.logoPath" class="way-icon" alt="" />
</div>
@ -92,12 +92,17 @@ function onPathPlayOver() {
playIdx.value = props.pathshop.length
}
const scroll = ref()
function onPathPlaying(e: any) {
// console.log(e.data) // {"pathArrIn": 0, "pathIndex": 1, "shopNum":"" }
const { shopNum } = e.data
if (shopNum) {
const idx2 = props.pathshop.findIndex((val: any) => val.shopNum === shopNum)
playIdx.value = idx2
if (scroll.value && document.getElementById(shopNum)) {
scroll.value.scrollToElement(document.getElementById(shopNum))
}
}
}
//playIdx
@ -123,6 +128,7 @@ const yourpos = computed(() => {
const lastImage = computed(() => {
return shop.value.logoUrl ?? require('@/assets/images/header/logo.svg')
})
defineExpose({
resetPlayIdx
})

Loading…
Cancel
Save