tabs自定义样式

2024-03-25 04:04
文章标签 自定义 样式 tabs

本文主要是介绍tabs自定义样式,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

在这里插入图片描述

使用el-tabs 去修改样式的话比较麻烦,索性直接用div来制作。

<div class="contain"><div class="tab_wrap"><div :class="['skew', 'first', active == '1' ? 'isActive': '']" @click="tabClick(1)"><span class="tabs__name">需求列表</span></div><div :class="['skew', 'second',active == '2' ? 'isActive': '']" @click="tabClick(2)"><span class="tabs__name">测试任务</span></div><div :class="['skew', 'third',active == '3' ? 'isActive': '']" @click="tabClick(3)"><span class="tabs__name">缺陷查看</span></div></div></div>
<script>
export default {data() {return {active: '1'}},methods: {tabClick(tab) {this.active = tab + ''}}
}
</script>

**

  • css有点烂 轻喷,先凑合实现吧。重复的样式代码太多了,没做处理。如果有同学优化了的可以打在评论区哦

**

<style lang="scss">
.contain {width: 100%;height: 100%;padding: 24px;
}
.tab_wrap {display: flex;border-bottom: 1px solid #ccc;
}
.skew {position: relative;width: 120px;height: 40px;
}
.first::before {content: "";position: absolute;top: 0;right: 20px;width: 100px;height: 40px;border-radius: 10px 10px 0 0;background: #e0e8f6;
}
.first::after {content: "";position: absolute;top: 0;left: 6px;right: 0;bottom: 0;border-radius: 10px 10px 0 0;background: #e0e8f6;transform: skewX(15deg);
}
.first {&.isActive::before {content: "";position: absolute;top: 0;right: 20px;width: 100px;height: 40px;border-top: 1px solid #ccc;border-left: 1px solid #ccc;border-radius: 10px 0;background: #fff;}&.isActive::after {content: "";position: absolute;top: 0;left: 6px;right: 0;bottom: 0;border-top: 1px solid #ccc;border-radius: 10px 10px 0 0;background: #fff;transform: skewX(15deg);}
}.second::before {content: "";position: absolute;top: 0;right: 13px;width: 100px;height: 40px;border-radius: 10px 10px 0 0;background: #e0e8f6;
}
.second::after {content: "";position: absolute;top: 0;left: 0;right: 0;bottom: 0;border-radius: 10px 10px 0 0;background: #e0e8f6;transform: skewX(15deg);
}
.second {&.isActive::before {content: "";position: absolute;top: 0;right: 30px;width: 100px;height: 40px;border-top: 1px solid #ccc;border-radius: 10px 10px 0 0;background: #fff !important;transform: skewX(-10deg);}&.isActive::after {content: "";position: absolute;top: 0;left: -4px;right: 0;bottom: 0;border-top: 1px solid #ccc;border-radius: 10px;background: #fff !important;transform: skewX(15deg);}
}.third::before {content: "";position: absolute;top: 0;right: -13px;width: 100px;height: 40px;border-radius: 10px 10px 0 0;background: #a8c7fa;
}
.third::after {content: "";position: absolute;top: 0;left: 0;right: 0;bottom: 0;border-radius: 10px 10px 0 0;background: #a8c7fa;transform: skewX(15deg);
}
.third {&.isActive::before {content: "";position: absolute;top: 0;right: -13px;width: 100px;height: 40px;border-top: 1px solid #ccc;border-right: 1px solid #ccc;border-radius: 10px 10px 0 0;background: #fff;}&.isActive::after {content: "";position: absolute;top: 0;left: 0;right: 0;bottom: 0;border-top: 1px solid #ccc;border-radius: 10px 0 0 0;background: #fff;transform: skewX(15deg);}
}
.tabs__name {position: absolute;top: 50%;left: 50%;transform: translate(-50%, -50%);z-index: 2;font-size: 14px;
}
</style>

这篇关于tabs自定义样式的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/843790

相关文章

spring-gateway filters添加自定义过滤器实现流程分析(可插拔)

《spring-gatewayfilters添加自定义过滤器实现流程分析(可插拔)》:本文主要介绍spring-gatewayfilters添加自定义过滤器实现流程分析(可插拔),本文通过实例图... 目录需求背景需求拆解设计流程及作用域逻辑处理代码逻辑需求背景公司要求,通过公司网络代理访问的请求需要做请

CSS3 布局样式及其应用举例

《CSS3布局样式及其应用举例》CSS3的布局特性为前端开发者提供了无限可能,无论是Flexbox的一维布局还是Grid的二维布局,它们都能够帮助开发者以更清晰、简洁的方式实现复杂的网页布局,本文给... 目录深入探讨 css3 布局样式及其应用引言一、CSS布局的历史与发展1.1 早期布局的局限性1.2

Spring Security自定义身份认证的实现方法

《SpringSecurity自定义身份认证的实现方法》:本文主要介绍SpringSecurity自定义身份认证的实现方法,下面对SpringSecurity的这三种自定义身份认证进行详细讲解,... 目录1.内存身份认证(1)创建配置类(2)验证内存身份认证2.JDBC身份认证(1)数据准备 (2)配置依

使用Sentinel自定义返回和实现区分来源方式

《使用Sentinel自定义返回和实现区分来源方式》:本文主要介绍使用Sentinel自定义返回和实现区分来源方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Sentinel自定义返回和实现区分来源1. 自定义错误返回2. 实现区分来源总结Sentinel自定

如何自定义Nginx JSON日志格式配置

《如何自定义NginxJSON日志格式配置》Nginx作为最流行的Web服务器之一,其灵活的日志配置能力允许我们根据需求定制日志格式,本文将详细介绍如何配置Nginx以JSON格式记录访问日志,这种... 目录前言为什么选择jsON格式日志?配置步骤详解1. 安装Nginx服务2. 自定义JSON日志格式各

Android自定义Scrollbar的两种实现方式

《Android自定义Scrollbar的两种实现方式》本文介绍两种实现自定义滚动条的方法,分别通过ItemDecoration方案和独立View方案实现滚动条定制化,文章通过代码示例讲解的非常详细,... 目录方案一:ItemDecoration实现(推荐用于RecyclerView)实现原理完整代码实现

基于Spring实现自定义错误信息返回详解

《基于Spring实现自定义错误信息返回详解》这篇文章主要为大家详细介绍了如何基于Spring实现自定义错误信息返回效果,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录背景目标实现产出背景Spring 提供了 @RestConChina编程trollerAdvice 用来实现 HTT

SpringSecurity 认证、注销、权限控制功能(注销、记住密码、自定义登入页)

《SpringSecurity认证、注销、权限控制功能(注销、记住密码、自定义登入页)》SpringSecurity是一个强大的Java框架,用于保护应用程序的安全性,它提供了一套全面的安全解决方案... 目录简介认识Spring Security“认证”(Authentication)“授权” (Auth

SpringBoot自定义注解如何解决公共字段填充问题

《SpringBoot自定义注解如何解决公共字段填充问题》本文介绍了在系统开发中,如何使用AOP切面编程实现公共字段自动填充的功能,从而简化代码,通过自定义注解和切面类,可以统一处理创建时间和修改时间... 目录1.1 问题分析1.2 实现思路1.3 代码开发1.3.1 步骤一1.3.2 步骤二1.3.3

dubbo3 filter(过滤器)如何自定义过滤器

《dubbo3filter(过滤器)如何自定义过滤器》dubbo3filter(过滤器)类似于javaweb中的filter和springmvc中的intercaptor,用于在请求发送前或到达前进... 目录dubbo3 filter(过滤器)简介dubbo 过滤器运行时机自定义 filter第一种 @A