罗世杰:feat:完成Dropdown组件的封装 fix:更改了pubulishSlide的样式bug
This commit is contained in:
@@ -1,14 +1,15 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="container">
|
<view class="container">
|
||||||
|
<view class="tabs-bg"/>
|
||||||
<view class="tabs">
|
<view class="tabs">
|
||||||
<view
|
<view
|
||||||
class="title-view"
|
class="title-view"
|
||||||
v-for="(item, index) in title"
|
v-for="(item, index) in title"
|
||||||
|
:key="item"
|
||||||
@click="changeActiveIndex(index)"
|
@click="changeActiveIndex(index)"
|
||||||
:class="{isActive: activeIndex === index}"
|
:class="{isActive: activeIndex === index}"
|
||||||
>
|
>
|
||||||
<text>{{item}}</text>
|
<text>{{item}}</text>
|
||||||
<!-- <text>{{index}}</text> -->
|
|
||||||
<view class="arrow" v-if="activeIndex !== index">
|
<view class="arrow" v-if="activeIndex !== index">
|
||||||
<u-image src="/static/dropdown/dp_icon_lxia.png" width="14rpx" height="11rpx"/>
|
<u-image src="/static/dropdown/dp_icon_lxia.png" width="14rpx" height="11rpx"/>
|
||||||
</view>
|
</view>
|
||||||
@@ -18,27 +19,51 @@
|
|||||||
|
|
||||||
</view>
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="item-border">
|
||||||
|
<DropDownItem v-if="activeIndex !== -1" :list="tablist"/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
/**
|
||||||
|
* @property {Array} postlist 传递一个二维数组
|
||||||
|
*/
|
||||||
|
import DropDownItem from "./DropDownItem.vue"
|
||||||
export default {
|
export default {
|
||||||
name:"DropDown",
|
name:"DropDown",
|
||||||
|
components: {
|
||||||
|
DropDownItem
|
||||||
|
},
|
||||||
|
props: {
|
||||||
|
postlist: {
|
||||||
|
type:Array,
|
||||||
|
default(){
|
||||||
|
return [['全部', '餐饮美食', '百货超市', '美容美发'],['区域1', '区域2', '区域3', '区域4'],['100m2','200m2','300m2'],['附近的', '最新发布的', '其他']]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
title: ['行业','区域','面积','筛选'],
|
title: ['行业','区域','面积','筛选'],
|
||||||
activeIndex: -1
|
activeIndex: -1,
|
||||||
|
// postlist: [['全部', '餐饮美食', '百货超市', '美容美发'],['区域1', '区域2', '区域3', '区域4'],['100m2','200m2','300m2'],['附近的', '最新发布的', '其他']]
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
computed: {
|
||||||
|
tablist: function() {
|
||||||
|
return this.postlist[this.activeIndex]
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
changeActiveIndex(index){
|
changeActiveIndex(index){
|
||||||
if(this.activeIndex === index){
|
if(this.activeIndex === index){
|
||||||
this.activeIndex = -1;
|
this.activeIndex = -1;
|
||||||
}
|
}else
|
||||||
this.activeIndex = index
|
this.activeIndex = index
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -47,12 +72,23 @@
|
|||||||
color: #CC3333;
|
color: #CC3333;
|
||||||
}
|
}
|
||||||
.container{
|
.container{
|
||||||
|
margin-top: 10px;
|
||||||
|
position: relative;
|
||||||
|
.tabs-bg {
|
||||||
|
position: absolute;
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
height: 120rpx;
|
||||||
|
width: 100%;
|
||||||
|
transform: translateY(-20rpx);
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
.tabs{
|
.tabs{
|
||||||
background-color: #fff;
|
background-color: #fff;
|
||||||
height: 100rpx;
|
height: 100rpx;
|
||||||
display: flex;
|
display: flex;
|
||||||
justify-content: space-around;
|
justify-content: space-around;
|
||||||
|
position: relative;
|
||||||
|
z-index: 3;
|
||||||
}
|
}
|
||||||
.title-view {
|
.title-view {
|
||||||
display: flex;
|
display: flex;
|
||||||
@@ -70,5 +106,9 @@
|
|||||||
justify-content: center;
|
justify-content: center;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
.item-border{
|
||||||
|
position: absolute;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,18 +1,69 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="root">
|
<view class="root">
|
||||||
|
<view class="mask"/>
|
||||||
|
<view class="list-container">
|
||||||
|
<view
|
||||||
|
class="item"
|
||||||
|
v-for="(item,index) in list"
|
||||||
|
>
|
||||||
|
<view></view>
|
||||||
|
<text class="list-text">{{item}}</text>
|
||||||
|
</view>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
export default {
|
||||||
|
props: {
|
||||||
|
list: {
|
||||||
|
type: Array,
|
||||||
|
default(){
|
||||||
|
return []
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss" scoped>
|
<style lang="scss" scoped>
|
||||||
|
.mask{
|
||||||
|
position: fixed;
|
||||||
|
top: 0;
|
||||||
|
left: 0;
|
||||||
|
width: 100%;
|
||||||
|
height: 100%;
|
||||||
|
background-color: #000;
|
||||||
|
-webkit-backdrop-filter:saturate(150%) blur(8px);
|
||||||
|
background-color:rgba(0,0,0,.3);
|
||||||
|
z-index: 20;
|
||||||
|
}
|
||||||
.root {
|
.root {
|
||||||
width: 100%;
|
|
||||||
height: calc(100% - 300rpx);
|
|
||||||
background-color: magenta;
|
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 4;
|
top: 0;
|
||||||
|
width: 100%;
|
||||||
|
|
||||||
|
font-size: 28rpx;
|
||||||
|
background-color: #fff;
|
||||||
|
position: absolute;
|
||||||
|
z-index: 1;
|
||||||
|
.list-container {
|
||||||
|
position: relative;
|
||||||
|
background-color: #fff;
|
||||||
|
width: 100%;
|
||||||
|
z-index: 21;
|
||||||
|
|
||||||
|
border-radius: 0px 0px 20px 20px;
|
||||||
|
.item {
|
||||||
|
border-top: 1px solid #EEEEEE;
|
||||||
|
font-weight: 500;
|
||||||
|
padding-left: 61rpx;
|
||||||
|
height: 80rpx;
|
||||||
|
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
justify-content: center;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
<template>
|
<template>
|
||||||
<view>
|
<view class="input-and-swiper-root">
|
||||||
<view class="search-box">
|
<view class="search-box">
|
||||||
<view class="search-box-input">
|
<view class="search-box-input">
|
||||||
<u-input placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search"
|
<u-input placeholder="热门搜索" placeholder-style="color: #969696" prefixIcon="search"
|
||||||
@@ -133,6 +133,10 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss">
|
||||||
|
.input-and-swiper-root {
|
||||||
|
position: relative;
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
.search-box {
|
.search-box {
|
||||||
position: absolute;
|
position: absolute;
|
||||||
z-index: 1;
|
z-index: 1;
|
||||||
|
|||||||
@@ -60,7 +60,7 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
.mask{
|
.mask{
|
||||||
position: fixed;
|
position: fixed;
|
||||||
top: 0;
|
top: 0;
|
||||||
|
|||||||
@@ -1,12 +1,17 @@
|
|||||||
<template>
|
<template>
|
||||||
<view class="root">
|
<view class="root">
|
||||||
<InputAndSwiper></InputAndSwiper>
|
<InputAndSwiper></InputAndSwiper>
|
||||||
<view class="content">
|
|
||||||
<view style="margin-top: 10px;">
|
<view>
|
||||||
|
<view class="dropdown-bug">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="marginLR10">
|
||||||
<DropDown></DropDown>
|
<DropDown></DropDown>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="marginLR10">
|
||||||
<SearchShopList :showStyle="1"></SearchShopList>
|
<SearchShopList :showStyle="1"/>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
|
|
||||||
<TabBar :current-page="3"></TabBar>
|
<TabBar :current-page="3"></TabBar>
|
||||||
@@ -14,7 +19,11 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
|
import DropDownItem from "@/components/DropDown/DropDownItem.vue"
|
||||||
export default {
|
export default {
|
||||||
|
components: {
|
||||||
|
DropDownItem
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
|
||||||
@@ -26,11 +35,23 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
page {
|
page {
|
||||||
background-color: $uni-bg-color-grey;
|
background-color: $uni-bg-color-grey;
|
||||||
}
|
}
|
||||||
.content{
|
.root{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.dropdown-bug {
|
||||||
|
position: absolute;
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
height: 120rpx;
|
||||||
|
width: 100%;
|
||||||
|
transform: translateY(-20rpx);
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.marginLR10{
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -2,14 +2,18 @@
|
|||||||
<view class="root">
|
<view class="root">
|
||||||
<InputAndSwiper></InputAndSwiper>
|
<InputAndSwiper></InputAndSwiper>
|
||||||
|
|
||||||
<view class="content">
|
<view>
|
||||||
<view style="margin-top: 10px;">
|
<view class="dropdown-bug">
|
||||||
|
|
||||||
|
</view>
|
||||||
|
<view class="marginLR10">
|
||||||
<DropDown></DropDown>
|
<DropDown></DropDown>
|
||||||
</view>
|
</view>
|
||||||
|
<view class="marginLR10">
|
||||||
<ShowShopList :showStyle="1"></ShowShopList>
|
<ShowShopList :showStyle="1"></ShowShopList>
|
||||||
|
</view>
|
||||||
</view>
|
</view>
|
||||||
<DropDownItem></DropDownItem>
|
|
||||||
<TabBar :current-page="1"></TabBar>
|
<TabBar :current-page="1"></TabBar>
|
||||||
</view>
|
</view>
|
||||||
</template>
|
</template>
|
||||||
@@ -31,11 +35,22 @@
|
|||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<style lang="scss">
|
<style lang="scss" scoped>
|
||||||
page {
|
page {
|
||||||
background-color: $uni-bg-color-grey;
|
background-color: $uni-bg-color-grey;
|
||||||
}
|
}
|
||||||
.content{
|
.root{
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
.dropdown-bug {
|
||||||
|
position: absolute;
|
||||||
|
background-color: $uni-bg-color-grey;
|
||||||
|
height: 120rpx;
|
||||||
|
width: 100%;
|
||||||
|
transform: translateY(-20rpx);
|
||||||
|
z-index: 2;
|
||||||
|
}
|
||||||
|
.marginLR10{
|
||||||
margin: 0 10px;
|
margin: 0 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user