Browse Source

feat: 初始化定位当前楼层

v1.0.1
jiannibang 3 years ago
parent
commit
5adcb45e91
  1. 9
      src/components/BrandScroll/BrandScroll.vue
  2. 1
      src/components/SearchResultList/SearchResultList.vue

9
src/components/BrandScroll/BrandScroll.vue

@ -3,7 +3,8 @@
<div class="brand-content"> <div class="brand-content">
<div class="groups" v-for="item of list" v-show="item.shopList.length" :key="item.name"> <div class="groups" v-for="item of list" v-show="item.shopList.length" :key="item.name">
<h1 class="info"> <h1 class="info">
{{ item.name }}<span class="meta">/ {{ item.shopList.length }}</span> <span v-if="item.name === currentFloor.floor" class="current">您在本层</span>
{{ item.name }}<span class="meta">/ {{ item.shopList.length }}</span>
<span v-if="item.name === currentFloor.floor" class="current" id="current">您在本层</span>
</h1> </h1>
<TransitionGroup name="zoom" mode="out-in" tag="div" :class="{ group: true, isRow }"> <TransitionGroup name="zoom" mode="out-in" tag="div" :class="{ group: true, isRow }">
<ShopItem <ShopItem
@ -65,6 +66,12 @@ watch(
nextTick(() => { nextTick(() => {
scroll.value.scrollToElement(el, 500, 0, -100) scroll.value.scrollToElement(el, 500, 0, -100)
}) })
} else {
const el = document.getElementById('current')
if (!el) return
nextTick(() => {
scroll.value.scrollToElement(el, 500, 0, -100)
})
} }
}) })
) )

1
src/components/SearchResultList/SearchResultList.vue

@ -118,7 +118,6 @@ function handleShop(item) {
position: absolute; position: absolute;
content: ''; content: '';
left: 0; left: 0;
top: 120px; top: 120px;
margin: auto; margin: auto;
width: 48px; width: 48px;

Loading…
Cancel
Save