dy-hu
11 months ago
2 changed files with 232 additions and 45 deletions
@ -0,0 +1,105 @@ |
|||
<template> |
|||
<view> |
|||
<view class="menu-window" :class="{ 'menu-window-visible': value }"> |
|||
<scroll-view style="height: 100%;" scroll-y="true" class="list"> |
|||
<view v-for="(vo,index) in cateList" :key="index" class="navlist" @click.stop="onCateClick(vo, index)"> |
|||
<span :class="{active:checked == index}">{{vo.classifyName}}</span> |
|||
</view> |
|||
</scroll-view> |
|||
</view> |
|||
<view class="mask" @touchmove.prevent :hidden="value === false" @click="onClose"></view> |
|||
</view> |
|||
</template> |
|||
|
|||
<script> |
|||
export default { |
|||
name: "slide-cate", |
|||
props: { |
|||
value: Boolean, |
|||
checked: Number, |
|||
cateList: Array, |
|||
}, |
|||
|
|||
methods: { |
|||
onClose() { |
|||
this.$emit("input", false); |
|||
}, |
|||
|
|||
onCateClick(item, index) { |
|||
this.$emit("checked", item, index); |
|||
this.$emit("input", false); |
|||
} |
|||
} |
|||
} |
|||
</script> |
|||
|
|||
<style lang="scss" scoped> |
|||
|
|||
|
|||
.mask { |
|||
position: fixed; |
|||
top: 0; |
|||
left: 0; |
|||
right: 0; |
|||
bottom: 0; |
|||
z-index: 55; |
|||
background-color: rgba(0, 0, 0, 0.5); |
|||
} |
|||
|
|||
.menu-window { |
|||
display: block; |
|||
position: fixed; |
|||
width: 85%; |
|||
height: 100%; |
|||
left: 0; |
|||
top: 86rpx; |
|||
//background-color: #fff; |
|||
background-color: rgba(255, 255, 255, 1); |
|||
z-index: 999; |
|||
transform: translateX(calc(-100%)); |
|||
transition: transform 0.3s ease; |
|||
} |
|||
|
|||
.menu-window-visible { |
|||
//z-index: 999; |
|||
transform: translateX(0px); |
|||
} |
|||
|
|||
.menu-window .list { |
|||
width: 100%; |
|||
display: flex; |
|||
flex-direction: column; |
|||
} |
|||
|
|||
.list{ |
|||
background-color: white; |
|||
color: #333333; |
|||
font-size: 14px; |
|||
padding-bottom: 20rpx; |
|||
padding-top: 20rpx; |
|||
width: 710rpx; |
|||
|
|||
.navlist { |
|||
box-sizing: border-box; |
|||
border-radius: 10vw; |
|||
margin-top: 20rpx; |
|||
margin-right: 3vw; |
|||
margin-left: 3vw; |
|||
padding: 1.2vw 3vw; |
|||
overflow: hidden; |
|||
white-space: nowrap; |
|||
text-overflow: ellipsis; |
|||
transition: all linear 0.2s; |
|||
} |
|||
|
|||
.active { |
|||
background-color: #252744; |
|||
border-radius: 10vw; |
|||
padding: 1.2vw 3vw; |
|||
color: white; |
|||
margin-right: -3vw; |
|||
margin-left: -3vw; |
|||
} |
|||
|
|||
} |
|||
</style> |
Write
Preview
Loading…
Cancel
Save
Reference in new issue