taro tab和swiper联动

tab页和swiper联动比较简单直接贴代码了


# index/index.jsx
import React, { Component } from 'react'
import { View, Swiper, SwiperItem, Image } from '@tarojs/components';
import './index.scss'
import { AtIcon, AtButton } from 'taro-ui';

const navList = ["全部", "待消费", "待评价", "退款", "其他订单"];


class OrderList extends Component {
    state = {
        current: 0,
    }
    Actived=(i)=> {
        this.setState({
            current: i
        })
    }
    changeTab=(e)=> {
        this.setState({
            current: e.detail.current,
        })
    }
    render() {
        const element = navList.map((i, index) =>
            <View className={this.state.current === index ? "order-nav-item-atived" : "order-nav-item"} onClick={() => this.Actived(index)} key={i}>
                <View >{i}</View>
            </View>

        )
        return (<View>
            <View className="order-nav"><View className="nav">{element}</View></View>
            <View>
                <Swiper onChange={this.changeTab} className="order-swiper"  current={this.state.current}  >
                    {navList.map((i, index) =>
                        <SwiperItem className="order-swiper-item" key={index}>

                            <View className="orde
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值