feat: 实现了无限轮播的展示卡片组件

This commit is contained in:
2026-04-28 13:59:43 +08:00
parent 2c9377c019
commit 4d975417da
3 changed files with 566 additions and 8 deletions

View File

@@ -1,22 +1,63 @@
<template>
<view>
<FindTabs v-model="activeIndex" @change="handleTabChange" />
<FindTabs
v-model="activeIndex"
:tabs="discoveryTabs"
/>
<CardSwiper
:list="discoveryCards"
@card-click="cardClick" />
<QuickQuestions />
</view>
</template>
<script setup>
import { ref } from "vue";
import { computed, ref } from "vue";
import FindTabs from "./components/FindTabs/index.vue";
import CardSwiper from "./components/CardSwiper/index.vue";
import QuickQuestions from "./components/QuickQuestions/index.vue";
import discoveryCover from "@/components/ImageSwiper/images/2025-07-12_180248.jpg";
const activeIndex = ref(0);
const discoveryCards = ref([
{
title: "卧龙潭漂流",
tag: "夏日必玩",
desc: "15米极速落差极致清凉体验。",
image: discoveryCover,
tabLabel: "卧龙潭",
},
{
title: "峡谷徒步",
tag: "清凉徒步",
desc: "穿行山谷栈道,沿路都是瀑布与云雾。",
image: discoveryCover,
tabLabel: "峡谷探秘",
},
{
title: "竹筏观景",
tag: "轻松观光",
desc: "低头可见鱼群,抬眼就是山水画卷。",
image: discoveryCover,
tabLabel: "竹筏观景",
},
{
title: "秘境潜游",
tag: "人气推荐",
desc: "近距离观察水下生态,沉浸感很强。",
image: discoveryCover,
tabLabel: "秘境潜游",
},
]);
const handleTabChange = (index) => {
activeIndex.value = index;
const discoveryTabs = computed(() =>
discoveryCards.value.map((item) => ({
label: item.tabLabel || item.title,
}))
);
const cardClick = (item) => {
console.log(JSON.stringify(item));
};
</script>
</script>