ソースを参照

feat: 添加自动播放功能到Swiper组件,并优化商品详情跳转逻辑

EvilDragon 1 ヶ月 前
コミット
f9e0fdd71c

+ 1 - 1
packages/app/src/components/swiper-evo.vue

@@ -6,7 +6,7 @@ const handleSwiperChange = async ({ detail: { current } }) => {
 }
 </script>
 <template>
-  <swiper class="w-full h-full" :current="modelValue" @change="handleSwiperChange">
+  <swiper class="w-full h-full" autoplay :current="modelValue" @change="handleSwiperChange">
     <template v-for="(it, i) in items" :key="i">
       <swiper-item>
         <div class="w-full h-full"><slot :item="it"></slot></div>

+ 7 - 2
packages/app/src/pages/home/mall/index.vue

@@ -113,7 +113,10 @@ onShow(async () => {
       <div class="absolute top-11 left-0 right-0 bottom-0 bg-white rounded-2xl shadow">
         <SwiperEvo v-model="current" :items="favourableProducts">
           <template #default="{ item: it }">
-            <div class="w-full h-full px-4 flex items-center gap-3 box-border">
+            <div
+              class="w-full h-full px-4 flex items-center gap-3 box-border"
+              @click="router.push(`/pages/home/mall/detail/index?id=${it.productId}`)"
+            >
               <wd-img
                 width="114"
                 height="114"
@@ -151,7 +154,9 @@ onShow(async () => {
                     积分
                   </div>
                   <div class="flex-1"></div>
-                  <div @click="router.push(`/pages/home/mall/detail/index?id=${it.productId}`)">
+                  <div
+                    @click.stop="router.push(`/pages/home/mall/detail/index?id=${it.productId}`)"
+                  >
                     <wd-img width="106" height="40" :src="grabNow"></wd-img>
                   </div>
                 </div>