<template>
    <div>
        <van-nav-bar
                title="tab"
                left-arrow
                @click-left="back"
        />
        <div class="page">
            <ul>
                <li class="section">
                    <y-tabs swipeable :selected.sync="index">
                        <y-tab-item title="当前任务" selected>
                            <div>
                                内容1
                            </div>
                        </y-tab-item>
                        <y-tab-item title="历史">
                            <div>
                                内容2
                            </div>
                        </y-tab-item>
                    </y-tabs>
                </li>
                <li>
                    {{index}}
                </li>
                <li class="section">
                    <y-tabs swipeable type="switch">
                        <y-tab-item title="当前任务" selected></y-tab-item>
                        <y-tab-item title="历史"></y-tab-item>
                    </y-tabs>
                </li>
                <li class="section">
                    <y-tabs swipeable type="switch" size="small" selected.sync="index">
                        <y-tab-item title="当前任务" selected></y-tab-item>
                        <y-tab-item title="历史"></y-tab-item>
                    </y-tabs>
                </li>
            </ul>
        </div>
    </div>
</template>

<script>
    import {NavBar} from 'vant';
    import yTabs from '../components/yTabs'
    import yTabItem from '../components/yTabItem'

    export default {
        components: {
            [NavBar.name]: NavBar,
            yTabs,
            yTabItem,
        },
        data:()=>{
            return {
                index:0,
                tipsShow:false
            }
        },
        methods:{
            fnClick(type){
                //yToast.success("success");
                //yToast.error("error");
                yToast.loading();
                switch (type) {
                    case 1:
                        yToast.loading("SDfsadf");
                        break;
                    case 2:
                        yToast.success();
                        break;
                    case 3:
                        yToast.error();
                        break;
                }
                setTimeout(yToast.clear,100000);
            },
            back:()=>{
                window.history.go(-1);
            }
        },
    }
</script>

<style scoped>
    .page {
        padding: 10px;
    }
</style>
