手撸vue菜单导航
手撸菜单导航由于做官网偷懒找现成模板,但没有一个比较符合心意,于是手撸了一个效果,可自行修改用的vue模板直接上全部代码<template><ul id="nav"><li class="nav1"><a href="#">在线客服</a><ul class="nav2"><li>证劵客服</li>&l
·
手撸菜单导航
由于做官网偷懒找现成模板,但没有一个比较符合心意,于是手撸了一个效果,可自行修改
用的vue模板
直接上全部代码
<template>
<ul id="nav">
<li class="nav1"><a href="#">在线客服</a>
<ul class="nav2">
<li>证劵客服</li>
<li>基财客服</li>
<li>银行客服</li>
<li>科技客服</li>
</ul>
</li>
<li class="nav1"><a href="#">在线客服</a>
<ul class="nav2">
<li>证劵客服</li>
<li>基财客服</li>
<li>银行客服</li>
<li>科技客服</li>
</ul>
</li>
</ul>
</template>
<script>
// @ is an alias to /src
export default {
name: 'Home',
}
</script>
<style lang="scss" scoped>
* {
margin: 0;
padding: 0;
text-decoration: none;
text-align: center;
list-style: none;
}
body {
font-size: 12px;
}
#nav {
display: flex;
justify-content: center;
.nav1 {
margin: 0 10px;
height: 40px;
display: inline-block;
a {
line-height: 40px;
display: block;
font-size: 20px;
color: #000;
font-weight: bold;
}
&:hover {
background-color: red;
color: #fff5f6;
}
}
}
.nav2 {
// display: inline-block;
position: relative;
z-index: 1;
height: 0;
overflow: hidden;
transition: height 0.5s;
li {
height: 50px;
background-color: #ffffff;
line-height: 60px;
background: #ff6700;
font-size: 12px;
&:hover {
background: blueviolet;
cursor: pointer;
}
&:hover a {
background: red;
cursor: pointer;
}
}
}
.nav1:hover .nav2 {
height: 540px;
}
</style>

更多推荐



所有评论(0)