| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- <template>
- <view class="container">
- <view class="tabs flex">
- <scroll-view scroll-x class="bg-white nav" style="width: 90%;">
- <view class="flex text-center">
- <view class="cu-item flex-sub" :class="index==current?'text-blue text-xl text-bold ':'text-lg'" v-for="(item,index) in tabs" :key="index" @tap="tabChange(index)" >
- {{item.name}}
- </view>
- </view>
- </scroll-view>
- <view class="" @click="tapFilterShow">
- <text class="cuIcon-filter" style="font-size: 40rpx;"></text>
- </view>
- </view>
- <view style="height: 100%;">
- <swiper style="height: 100%;" :current="current" @change="swiperChange"
- @animationfinish="animationfinish">
- <swiper-item v-for="(item, index) in tabs" :key="index">
- <scroll-view scroll-y style="height: 100%;">
- <item ref="mescrollItem" :refresh="refresh" :i="index" :item="item" :type="current"></item>
- </scroll-view>
- </swiper-item>
- </swiper>
- </view>
- </view>
- </template>
- <script>
- import item from "./item.vue"
- export default {
- components: {
- item
- },
- data() {
- return {
- //让item主动刷新
- refresh:false,
- scrollLeft:0,
- current: 0,
- swiperCurrent:0,
- tabs: [
- {
- name: '全部',
- value:-1
- },
- {
- name: '待审核',
- value:0
- },
- {
- name: '已通过',
- value:1
- },
- {
- name:'未通过',
- value:2
- }
- ],
- }
- },
- onShow(){
- if(this.canReset){
- let curMescroll = this.getMescroll(this.current)
- // curMescroll.scrosllTo(0, 100);
- curMescroll && curMescroll.resetUpScroll()
- }
- this.canReset = true
- },
- methods:{
- tapFilterShow(){
- let mescrollItems = this.$refs.mescrollItem;
- if(mescrollItems){
- let item = mescrollItems[this.current]
- item.show()
- }
- },
- tabChange(index) {
- this.current = index
- },
- swiperChange(e) {
- uni.pageScrollTo({
- scrollTop: 0,
- duration: 0
- });
- this.current = e.detail.current
- },
- animationfinish({detail: { current }}) {
- this.swiperCurrent = current;
- this.current = current;
- },
- getMescroll(i){
- let mescrollItems = this.$refs.mescrollItem;
- if(mescrollItems){
- let item = mescrollItems[i]
- if(item) return item.mescroll
- }
- return null
- }
- }
- }
- </script>
- <style lang="scss" scoped>
- .text-blue{
- color: #59a5f0;
- }
- .text-xl{
- font-size: 34rpx;
- }
- .container {
- height: calc(100vh);
- background-color: #F6F6F6;
- padding: 78rpx 0rpx 0rpx;
- .tabs {
- position: fixed;
- top: -10rpx;
- left: 0;
- display: flex;
- align-items: center;
- width: 100%;
- background-color: #FFFFFF;
- box-sizing: border-box;
- z-index: 3;
- }
- }
- </style>
|