vue tab组件

<template>
    <div class="tab-container" style="margin-top: 20px;">
        <el-tabs v-model="activeTab" style="margin-top:15px;" type="border-card" @tab-click="handleClick">
            <el-tab-pane name="base" label="'组件1显示名称'">
                <组件1 v-if="组件1显示标识 "/>
            </el-tab-pane>

            <el-tab-pane name="service" label="'组件2显示名称'">
                <组件2 v-if="组件2显示标识"/>
            </el-tab-pane>

        </el-tabs>
    </div>
</template>

<script>
    import 组件1 from "./组件1";
    import 组件2 from "./组件2";

    export default {
        name: 'Tab',
        components: {
            组件1, 组件2
        },
        data() {
            return {
                activeTab:"base",//默认选择哪个页
                组件1显示名称: true,
                组件2显示名称: false,
            }
        },
        watch: {
            activeName(val) {
                // this.$router.push(`${this.$route.path}?tab=${val}`)
            }
        },
        created() {

        },
        methods: {
            handleClick() {
                if (this.activeTab == "base") { //默认显示组件1的页
                    this.baseservice = true;
                    this.egisservice = false;
                } else if (this.activeTab == "service") {
                    this.egisservice = true;
                    this.baseservice = false;
                }
            },
        },
        mounted() {
            this.handleClick();
        },
        beforeDestroy() {
            //this.$refs.enterpriseVideo.destroyHk();
        },
        destroyed() {//页面销毁,同时也销毁video.js对象

            this.$nextTick(() => {
                //this.$refs.enterpriseVideo.destroyHk();
            })
        }
    }

</script>


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值