vue高仿立体卡片效果(第一版)

如图所示:

代码如下:(复制另存txt,修改.html直接运行)
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>vue高仿立体卡片效果</title>
  <!-- 引入样式 -->
  <link rel="stylesheet" href="https://unpkg.com/element-ui/lib/theme-chalk/index.css">
  <style>
    .fu{
      margin: 0 auto;
      background: #eee;
      height: 50px;
      display: flex;
      position:relative;
      text-align: center;
    }
    .fu .zi{
        flex:1;
        height: 40px;
        line-height: 40px;
        background: #ddd;
        position: relative;
        bottom: 0;
        margin-top: 10px;
    }
    .fu .rightBox::after{
      content: '';
      position: absolute;
      z-index: 2;
      bottom: 0;
      right: -10px;
      height: 50px;
      width: 15px;
      background: #fff;
      box-shadow: 2px 0px 0px #aaa;
      transform: skew(10deg);
      border-radius: 0 5px 0 0;
    }
     .leftBox::before{
      content: '';
      position: absolute;
      z-index: 1;
      left: -10px;
      height: 50px;
      width: 15px;
      background: #fff;
      box-shadow: -2px 0px 0px #aaa;
      transform: skew(-10deg);
      border-radius: 5px 0 0 0;
    }
    .fu .active{
      background: #fff;
      height: 50px;
      line-height: 50px;
      bottom: 10px;
    }
  </style>
</head>
<body style="background: #eee;">
  <div id="app">
    <div class="fu">
      <span class="zi" :class="[tabIndex == 0?'rightBox active':'']" @click="clickTab(0)" >吃鸡</span>
      <span class="zi" :class="[tabIndex == 1?'active rightBox leftBox':'']" @click="clickTab(1)">王者</span>
      <span class="zi" :class="[tabIndex == 2?'leftBox active':'']" @click="clickTab(2)">LOL</span>
    </div>
    <div style="background: #fff;height: 100px;text-indent: 2em;">
        {{['P城刚枪,成为P城之王!','王者滴滴,实力带飞!','面对疾风吧!哈撒给,嘿呀给给痛'][tabIndex]}}
    </div>
  </div>
</body>

<script src="https://lib.baomitu.com/vue/2.6.14/vue.js"></script>
<!-- 引入组件库 -->
<script src="https://unpkg.com/element-ui/lib/index.js"></script>
<!-- 引入 echart -->
<script src="https://lib.baomitu.com/echarts/5.2.0/echarts.common.js"></script>

<script>
  new Vue({
    el: '#app',
    data() {
      return { 
        tabIndex:0,
      }
    },
    mounted(){

    },
    methods: {
      clickTab(val){
        this.tabIndex = val
      }
    }
  })
</script>
</html>
vue高仿立体卡片效果(第二版): vue高仿立体卡片效果(第二版)
vue高仿立体卡片效果(第三版): vue高仿立体卡片效果(第三版)
番外篇:

越来越发现管理的重要性,码农常有,而管理不常有,好的管理事半功倍。

你可能感兴趣的:(Element,Vant,css,vue.js,前端,css3)