elemntui-tab添加圖標



        <el-tabs :before-leave="moreState" v-model="activeName" @tab-click="handleClick">
            <el-tab-pane label="用戶管理" name="first">用戶管理</el-tab-pane>
            <el-tab-pane label="配置管理" name="second">配置管理</el-tab-pane>
            <el-tab-pane label="角色管理" name="third">角色管理</el-tab-pane>
            <el-tab-pane label="定時任務補償" name="fourth">定時任務補償</el-tab-pane>

            <el-tab-pane name="more" class="more-btn">
                <div slot="label">
                    <i class="iconfont icon-input"></i>
                    <i class="iconfont icon-enable"></i>
                    <i class="iconfont icon-lock"></i>
                </div>
            </el-tab-pane>
        </el-tabs>
  activeName: 'second'

  methods: {
        post(mess) {
            console.log(mess);
        },

        handleClick(tab, event) {
            console.log(tab, event);
            if (this.activeName == "second") {

            } else if (this.activeName == "third") {

            } else if (this.activeName == "fourth") {

            }
        },
       
        moreState(tab, event) {
            if (tab == 'more') {
                console.log("/////", tab, event);
                return false;
            }
        }
    },


<style lang="scss" scoped>
/deep/ #tab-more {
    width: calc(100% - 200px);
    text-align: right;
}

/deep/ .el-tabs__nav {
    width: calc(100% - 200px);
}
</style>

tab的最右邊 通常有一些按鈕。
這些按鈕就是做一操作。
我們可以利用鈎子函數 來做的moreState


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM