有没有大佬知道这样的分段器效果如何实现?-灵析社区

开挂思想家

![image.png](https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241107/c163042c0e4399a376a6e684ef0aaff4.png) ![image.png](https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241107/b484602dbca73db7dd480cb79f0a30c6.png) 有没有大神知道这样的分段器效果如何实现? ![image.png](https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241107/c163042c0e4399a376a6e684ef0aaff4.png) ![image.png](https://wmlx-new-image.oss-cn-shanghai.aliyuncs.com/images/20241107/b484602dbca73db7dd480cb79f0a30c6.png) 有没有大神知道这样的分段器效果如何实现? 点击左侧按钮时右侧边框变为45度曲线,点击右侧反之,这个咋整?

阅读量:20

点赞量:0

问AI
可以参考下这个 "https://jsrun.net/JHFKp" (https://link.segmentfault.com/?enc=xCfV1EMPjs5D1cYzvZl9vA%3D%3D.JNASEr4JwJzC9EnXf8uxygVoap9N4cBqTJw5OmgFVhg%3D) 梯形tab按钮-基于clip-path path函数实现 .wrap { background-color: #eee; width: 375px; margin: 0 auto; padding: 10px; } .tabs { display: flex; width: 100%; overflow: hidden; border-radius: 8px 8px 0 0; background: linear-gradient(#cdd9fe, #e2e9fd); } .tab { flex: 0 0 50.1%; height: 50px; cursor: pointer; position: relative; text-align: center; line-height: 50px; } .tab.active { background-color: #fff; color: #4185ef; } .tab.active:before { content: ''; position: absolute; top: 0; left: -50px; height: 100%; width: 50px; z-index: 2; background-color: #fff; clip-path: path('M 0,50 C 25,50 25,0 50,0 L 50, 50 Z'); } .tab.active:after { content: ''; position: absolute; top: 0; right: -50px; height: 100%; width: 50px; z-index: 2; background-color: #fff; clip-path: path('M 0,0 C 25,0 25,50 50,50 L 0, 50 Z'); } .content-wrap { min-height: 200px; background-color: #fff; } // pass unocss options window.__unocss = { rules: [ // custom rules... ], presets: [ // custom presets... ], // ... } function initData() { return { activeIndex: 1, onTabClick(index) { this.activeIndex = index } } }