• 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>
  • 相关阅读:
    插件制作入门
    Hank老师推荐的一些博客
    高级iOS工程师的博客
    查看一个文件是否支持64位 方法 ,[symbol(s) not found for architecture x86_64]相关
    ssh-keygen的使用方法及配置authorized_keys两台linux机器相互认证
    使用git在两台机器间同步代码
    scp远程拷贝命令
    后台启动程序并重定向输出信息脚本
    automake 工具的使用
    minigui启动过程
  • 原文地址:https://www.cnblogs.com/yhhBKY/p/11996791.html
Copyright © 2020-2023  润新知