clip-path 加邊框border


最近些項目,需求是寫一個箭頭圖案,想着就用clip-path來寫,但是寫到后來發現clip-path 無法加邊框,最后用了個死辦法寫了出來,僅供參考

下圖是設計圖

如下是實現方案(就是寫兩層,外面一層灰色,里面一層白色覆蓋)

<template>
    <section class="moveCompanyLimits">
      <div class="tabBar">
          <div class="tabBar_border" :style="isFocus ? 'background: #fff;' : 'background: #d7d7d7;'">
            <div :style="isFocus ? 'background: #d7d7d7;' : 'background: #fff;'" class="admin_old" @click="changeAdmin(true)">111</div>
            <div class="admin_new" @click="changeAdmin(false)">222</div>
          </div>
      </div>
      <div>

      </div>
    </section>
</template>
<script>
export default {
    data () {
        return {
            isFocus:false
        }
    },
    methods:{
        changeAdmin(boolean){
            this.isFocus = boolean
        }
    }
}
</script>
<style lang="less" scoped>
.moveCompanyLimits{
    .tabBar{
        margin: 20px auto;
        font-size: 14px;
        text-align: center;
        line-height: 45px;
        width: 100%;
        height: 46px;
        background: #d7d7d7;
        clip-path: polygon(0% 0%, 96% 0px, 100% 50.00%, 96% 100%, 0px 100%);
        border: 1px solid #d7d7d7;
        .tabBar_border{
            display: flex;
            align-items: center;
            width: 100%;
            height: 44px;
            background: #d7d7d7;
            clip-path: polygon(0% 0%, 96% 0px, 100% 50.00%, 96% 100%, 0px 100%);
        }
        .tabBar_border div{
            width: 50%;
            cursor: pointer;
        }
        .admin_old{
            height: 44px;
            background: #fff;
            clip-path: polygon(0% 0%, 92% 0px, 100% 50.00%, 92% 100%, 0px 100%);
        }
        .admin_old:focus{
            background: red;
        }
    }
}
</style>

 


免責聲明!

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



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