当前位置: 首页 > news >正文

奇怪的异形选项卡样式、弧形边框选项卡

 

<template>
  <div :class="$options.name">
    <div class="tab">默认选项卡</div>
    <div class="tab" active>选中选项卡</div>
    <el-divider />
    <el-tabs v-model="tabActiveName" @tab-click="(tab, event) => {}" type="">
      <el-tab-pane
        :label="tab.label"
        :name="tab.value.toString()"
        v-for="(tab, index) in tabs"
        :key="index"
        :disabled="tab.disabled"
      >
        <span slot="label">
          <el-badge
            :value="(tab.badge || {}).value"
            :max="99"
            :type="(tab.badge || {}).type || `danger`"
            :hidden="!tab.badge"
          >
            {{ tab.label }}
          </el-badge>
        </span>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>
<script>
export default {
  name: "demo",

  data() {
    return {
      tabs: [
        { value: 1, label: "显示文本1" },
        { value: 2, label: "显示文本2" },
        { value: 3, label: "显示文本3" },
      ],
      tabActiveName: "1", //name必须是String类型,否者tab默认样式聚焦状态下不会显示下划线
    };
  },
};
</script>
<style lang="scss" scoped>
.demo {
  >>> .el-tabs__active-bar {
    display: none;
  }
  >>> .el-tabs__item,
  .tab {
    // transform: perspective(30px) rotateX(20deg);//3D立体效果
    $backgroundColor: #bedeff;
    $backgroundColorAcitve: #409eff;

    $cornerWidth: 15px;
    $cornerHeight: 15px;
    $tabHeight: 40px;
    // ----------------------------------------
    box-sizing: border-box;
    padding: 0 20px !important;
    width: max-content;
    height: $tabHeight;
    background-color: $backgroundColor;
    border-radius: $cornerWidth $cornerWidth 0 0;
    position: relative;
    transform-origin: center bottom;
    display: inline-flex;
    justify-content: center;
    align-items: center;
    color: $backgroundColorAcitve;

    @mixin leftBg($backgroundColor: $backgroundColorAcitve) {
      background: radial-gradient(
        circle at 0 0,
        transparent $cornerWidth,
        $backgroundColor $cornerWidth
      );
    }
    @mixin rightBg($backgroundColor: $backgroundColorAcitve) {
      background: radial-gradient(
        circle at 100% 0,
        transparent $cornerWidth,
        $backgroundColor $cornerWidth
      );
    }
    &::before,
    &::after {
      content: "";
      position: absolute;
      width: $cornerWidth;
      height: $cornerWidth;
      bottom: 0;
    }

    &::before {
      left: -$cornerWidth;
      @include leftBg($backgroundColor);
    }

    &::after {
      right: -$cornerWidth;
      @include rightBg($backgroundColor);
    }
    &[active],
    &.active,
    &.is-active {
      z-index: 1;
      $backgroundColor: $backgroundColorAcitve;
      color: white;
      background-color: $backgroundColor;
      &::before {
        @include leftBg($backgroundColor);
      }

      &::after {
        @include rightBg($backgroundColor);
      }
    }
  }
}
</style>

相关文章:

  • Go语言中package的使用规则《二》
  • java基础之windows电脑基础命令
  • 【其他】在线安装DataEase后无法远程访问
  • k近邻图(knn-graph)和局部线性嵌入图(LLE-graph)的相似性和区别
  • Python JSON模块loads、load、dump、dumps详解
  • Sql Server 索引性能优化 分析以及分表
  • 【LeetCode】大厂面试算法真题回忆(37)--知识图谱新词挖掘
  • 大数据从入门到入魔系列————探索大数据前世今生之迷
  • Unity | 游戏数据配置
  • SpringBoot整合MQTT最详细版(亲测有效)
  • 创建自己的github.io
  • Jmeter插件下载和配置
  • 终端的命令行发送邮件的方式和监视脚本
  • windows专用网路的共享文件配置
  • EtherCAT转profinet网关集成汽车变速箱制造生产线自动化升级
  • 高频GNSS同震形变计算方法
  • 可发1区的超级创新思路:基于注意力机制的DSD-CNN时间序列预测模型(功率预测、交通流量预测、故障检测)
  • Python学习第二十二天
  • 智能体开发革命:灵燕平台如何重塑企业AI应用生态
  • Lineageos 22.1(Android 15)应用双开
  • 江苏银行一季度净赚近98亿增逾8%,不良贷款率微降
  • 事关稳就业稳经济,10张海报看懂这场发布会的政策信号
  • 释新闻|SEVIS是什么?在美留学生遭身份中止意味什么?
  • “梅花奖”快闪走入上海张园,朱洁静在石库门前起舞
  • 乌称泽连斯基与特朗普进行简短会谈
  • 中国平安一季度净赚270亿降逾26%,营运利润增2.4%