Files
tuniao-ui/vipPage/components/stack-swiper/stack-swiper.vue
T
2026-03-19 10:47:37 +08:00

74 lines
2.2 KiB
Vue

<template>
<view class="vip-component-stack-swiper tn-safe-area-inset-bottom">
<!-- 顶部自定义导航 -->
<tn-nav-bar fixed>StackSwiper堆叠轮播</tn-nav-bar>
<view :style="{paddingTop: vuex_custom_bar_height + 'px'}">
<demo-title title="基础使用">
<tn-stack-swiper :list="list"></tn-stack-swiper>
</demo-title>
<demo-title title="自动轮播">
<tn-stack-swiper :list="list" :autoplay="autoplay"></tn-stack-swiper>
</demo-title>
<demo-title title="切换阈值">
<tn-stack-swiper :list="list" :switchRate="50"></tn-stack-swiper>
</demo-title>
<demo-title title="修改轮播图的宽高">
<tn-stack-swiper :list="list" :height="300" width="80%"></tn-stack-swiper>
</demo-title>
<demo-title title="垂直堆叠轮播">
<view class="tn-flex tn-flex-row-center tn-flex-col-center">
<tn-button backgroundColor="#01BEFF" fontColor="#FFFFFF" @click="navVerticalStackSwiper">演示(建议全屏使用)</tn-button>
</view>
</demo-title>
<view class="tn-padding-bottom-lg"></view>
</view>
</view>
</template>
<script>
import demoTitle from '@/libs/components/demo-title.vue'
export default {
name: 'VipComponentStackSwiper',
components: { demoTitle },
data() {
return {
autoplay: false,
list: [
{image: 'https://resource.tuniaokj.com/images/swiper/spring.jpg'},
{image: 'https://resource.tuniaokj.com/images/swiper/summer.jpg'},
{image: 'https://resource.tuniaokj.com/images/swiper/autumn.jpg'},
{image: 'https://resource.tuniaokj.com/images/swiper/winter.jpg'}
]
}
},
onShow() {
// 一定要这样,否者会导致定时器不工作
this.autoplay = true
},
onHide() {
this.autoplay = false
},
methods: {
navVerticalStackSwiper() {
uni.navigateTo({
url: '/vipPage/home/card/card'
})
}
}
}
</script>
<style lang="scss" scoped>
.vip-component-stack-swiper {
min-height: 100vh;
}
</style>