Giter Club home page Giter Club logo

Comments (2)

akFace avatar akFace commented on June 7, 2024

还有两个优化点:

1、加个参数textSelectSize,设置tab字体选中的大小

2、指示器与文字的间距,如图:

JF7LTO{ )B}9ZQYTV4@W9)P

from eeui.

akFace avatar akFace commented on June 7, 2024

【已解决】

@kuaifan 提供的方案

完全自定义方法:

在线演示->>

<template>
    <div class="app">

        <div class="nav">
            <template v-for="(item, index) in tabPages">
                <text :class="[index === position ? 'nav-active' : 'nav-item']" @click="switchPage(index)">{{item.title}}</text>
                <text v-if="index < tabPages.length - 1" class="nav-line"></text>
            </template>
        </div>

        <tabbar
                ref="reflectName"
                class="tabbar"
                :eeui="{ tabType: 'top', tabHeight: 0 }"
                :tabPages="tabPages"
                @pageSelected="pageSelected"></tabbar>

    </div>
</template>

<style>
    .app {
        flex: 1
    }

    .nav {
        width: 750px;
        height: 100px;
        background-color: #3EB4FF;
        flex-direction: row;
        justify-content: center;
        align-items: center;
    }

    .nav-item,
    .nav-active {
        width: 120px;
        height: 100px;
        line-height: 100px;
        text-align: center;
        font-size: 28px;
        color: #ffffff;
        font-weight: 300;
    }

    .nav-active {
        color: #E1C040;
        font-weight: 600;
        border-bottom-width: 6px;
        border-bottom-style: solid;
        border-bottom-color: #E1C040;
    }

    .nav-line {
        height: 24px;
        width: 1px;
        background-color: #ffffff;
    }

    .tabbar {
        flex: 1;
        width: 750px;
    }
</style>

<script>
    export default {
        data() {
            return {
                position: 0,

                tabPages: [
                    {
                        tabName: 'home',
                        title: '首页',
                        url: 'http://dotwe.org/raw/dist/b5fd96d8d790f0100bdfc20b93eedf09.bundle.wx',
                    },
                    {
                        tabName: 'friend',
                        title: '好友',
                        url: 'http://dotwe.org/raw/dist/ba938c9aaebe41e5f60b98f90bd0bf61.bundle.wx',
                    },
                    {
                        tabName: 'group',
                        title: '圈子',
                        url: 'http://dotwe.org/raw/dist/fb6f016b0116969b6b503e1d3a35285f.bundle.wx',
                    },
                    {
                        tabName: 'setting',
                        title: '设置',
                        url: 'http://dotwe.org/raw/dist/ad0045a7cff0b3a680d9de6dd4806e81.bundle.wx',
                    },
                ],
            }
        },
        methods: {
            pageSelected(data) {
                this.position = data.position;
            },
            switchPage(index) {
                this.position = index;
                this.$refs.reflectName.setCurrentItem(this.tabPages[index].tabName);
            }
        }
    };
</script>


from eeui.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.