index.vue 1.43 KB
<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>