diff --git a/src/components/PathGroup/PathGroup.vue b/src/components/PathGroup/PathGroup.vue index a7593d3..ec1b6c1 100644 --- a/src/components/PathGroup/PathGroup.vue +++ b/src/components/PathGroup/PathGroup.vue @@ -16,7 +16,7 @@ {{ yourpos }} -
  • +
  • @@ -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 })