<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Document</title>
<script src="https://cdn.jsdelivr.net/npm/vue@2"></script>
<style>
*{
padding: 0;
margin: 0;
}
.ulBox{
width: 100px;
height: 550px;
background: #ccc;
}
li{
height: 100px;
width: 100%;
list-style: none;
z-index: 10;
}
.active{
background: #fff;
border-radius: 10px 0 0 10px;
position: relative;
}
.active > .square{
width: 20px;
height: 20px;
position: absolute;
right: 0;
background:#fff;
}
.active > .square::after{
content: '';
width: 100%;
height: 100%;
background: #ccc ;
position: absolute;
bottom: 0;
right: 0;
}
.active > .squareTop{
top: -20px;
}
.active > .squareBtm{
bottom: -20px;
}
.active > .squareTop::after{
border-radius: 0 0 50% 0;
}
.active > .squareBtm::after{
border-radius: 0 50% 0 0;
}
</style>
</head>
<body>
<div id="app">
<ul class="ulBox">
<li v-for="(item,index) in 5"
@click="change(index)"
:key="index"
:class="activeIndex == index?'active':''">
<p class="squareTop square"></p>
<p>{{item}}</p>
<p class="squareBtm square"></p>
</li>
</ul>
</div>
</div>
<script>
var app = new Vue({
el: '#app',
data: {
activeIndex:0
},
methods:{
change(index){
this.activeIndex = index
}
}
});
</script>
</body>
</html>
css 实现 圆角外翻 border-radius
最新推荐文章于 2024-10-21 16:42:31 发布