index.vue
1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
<template>
<z-paging-swiper>
<template v-slot:top>
<u-tabs lineWidth="40" lineColor="#ffffff" lineHeight="6"
:activeStyle="{ 'color': '#ffffff', 'font-weight': 'bolder' }" :inactiveStyle="{ color: '#ffffff' }"
ref="uTabsElement" :list="list" :current="current" @change="tabsChange" :scrollable="false"></u-tabs>
</template>
<swiper class="swiper" :current="swiperCurrent" @translation="translation" @animationfinish="animationfinish">
<swiper-item class="swiper-item" v-for="(item, index) in list" :key="index">
<swiper-list-item :tabIndex="index" :currentIndex="swiperCurrent"></swiper-list-item>
</swiper-item>
</swiper>
</z-paging-swiper>
</template>
<script setup>
import { ref } from 'vue';
import swiperListItem from './swiper-list-item/index.vue';
const list = ref([{ name: '待清运' }, { name: '清运中' }, { name: '全部' }, { name: '已完成' }])
const current = ref(0);
const swiperCurrent = ref(0)
const uTabsElement = ref()
const tabsChange = (el) => {
swiperCurrent.value = Number(el.index)
}
const animationfinish = (e) => {
current.value = e.detail.current
swiperCurrent.value = e.detail.current
}
const translation = (e) => {
uTabsElement.value.setDx(e.detail.dx)
}
</script>
<style lang="scss" scoped>
.swiper {
height: 100%;
background: linear-gradient(to bottom, #19a97c, $u-bg-color, $u-bg-color, $u-bg-color, $u-bg-color, $u-bg-color, $u-bg-color);
}
</style>