main
liudan 2 years ago
parent 85a669d1be
commit 7991c4e3cb
  1. 162
      components/wyb-drop-down/wyb-drop-down.vue
  2. 3
      manifest.json
  3. 22
      pages/index/searchPage.vue
  4. BIN
      static/nodata.png

@ -11,83 +11,84 @@
:style="{
zIndex: zIndex,
backgroundColor: bgColor.header}">
<view
class="wyb-drop-down-header-item"
v-for="(item,index) in options"
:key="item.header"
@tap.stop="onHeaderTap(index)"
:style="{fontSize: fontSize.header + 'rpx'}">
<text
class="wyb-drop-down-header-item-label"
<view class="headercontainer">
<view
class="wyb-drop-down-header-item"
v-for="(item,index) in options"
:key="item.header"
@tap.stop="onHeaderTap(index)"
:style="{fontSize: fontSize.header + 'rpx'}">
<text
class="wyb-drop-down-header-item-label"
:style="{
fontWeight: headerActiveIndex === index && dropOver && activeWeight ? 'bold' : 'normal',
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}">{{item.header}}</text>
<text
v-if="dropIcon === 'fill'"
class="iconfont icon-down-fill wyb-drop-down-header-item-icon"
:class="[headerActiveIndex === index && dropOver ? 'wyb-drop-down-header-item-icon-active' : '']"
:style="{
fontSize: fontSize.header - 5 + 'rpx',
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}" />
<text
v-if="dropIcon==='line'"
class="iconfont icon-down wyb-drop-down-header-item-icon"
:class="[headerActiveIndex === index && dropOver ? 'wyb-drop-down-header-item-icon-active' : '']"
:style="{
fontSize: fontSize.header - 5 + 'rpx',
transformOrigin: '50% 45%',
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}" />
<view class="wyb-drop-down-vline" v-if="index !== options.length - 1" /></view>
</view>
<u-search placeholder="输入搜索内容"
:focus="false"
@focus="clickHandle"
@blur="blurHandle"
:showAction="false"
:class="disabled?'withSearch':'withSearch withSearchDisabled'"
bgColor="#F3F5F7"
@search="searchHandle"
v-model="catagoryName"></u-search>
<scroll-view
v-if="dropDown"
class="wyb-drop-down-content"
:class="[dropOver ? 'wyb-drop-down-content-active' : '']"
:scroll-y="scroll"
:enable-flex="true"
:scroll-anchoring="true"
:style="{
fontWeight: headerActiveIndex === index && dropOver && activeWeight ? 'bold' : 'normal',
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}">{{item.header}}</text>
<text
v-if="dropIcon === 'fill'"
class="iconfont icon-down-fill wyb-drop-down-header-item-icon"
:class="[headerActiveIndex === index && dropOver ? 'wyb-drop-down-header-item-icon-active' : '']"
:style="{
fontSize: fontSize.header - 5 + 'rpx',
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}" />
<text
v-if="dropIcon==='line'"
class="iconfont icon-down wyb-drop-down-header-item-icon"
:class="[headerActiveIndex === index && dropOver ? 'wyb-drop-down-header-item-icon-active' : '']"
:style="{
fontSize: fontSize.header - 5 + 'rpx',
transformOrigin: '50% 45%',
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}" />
<view class="wyb-drop-down-vline" v-if="index !== options.length - 1" /></view>
zIndex: zIndex - 1,
fontSize: fontSize.content + 'rpx',
backgroundColor: bgColor.content,
borderBottomLeftRadius: radius + 'px',
borderBottomRightRadius: radius + 'px',
minHeight: minHeight + 'rpx',
height: autoHeight ? 'auto' : minHeight + 'rpx',
maxHeight: autoHeight && maxHeight ? maxHeight + 'rpx' : 'auto'}">
<view class="wyb-drop-down-content-box" v-for="(item,index) in options" :key="contentBoxKey(index)">
<view v-if="item['custom'] && headerActiveIndex === index && dropDown" class="wyb-drop-down-content-slot">
<slot></slot>
</view>
<view
v-if="!item['custom'] && headerActiveIndex === index && dropDown"
class="wyb-drop-down-content-item"
v-for="(content,zIndex) in item['contents']"
:key="content"
@tap.stop="onContentItemsTap(zIndex)">
<text
class="wyb-drop-down-content-item-label"
:style="{color: contentActiveIndexList[headerActiveIndex]['index'] === zIndex && dropOver ? activeColor: defaultColor}">
{{content}}
</text>
<text
v-if="contentActiveIndexList[headerActiveIndex]['index'] === zIndex && dropOver"
:style="{color: activeColor}"
class="iconfont icon-selected wyb-drop-down-content-item-icon" />
<view class="wyb-drop-down-line" v-if="zIndex !== options[headerActiveIndex].contents.length - 1" />
</view>
</view>
</scroll-view>
</view>
<u-search placeholder="输入搜索内容"
:focus="false"
@focus="clickHandle"
@blur="blurHandle"
:showAction="false"
:class="disabled?'withSearch':'withSearch withSearchDisabled'"
bgColor="#F3F5F7"
@search="searchHandle"
v-model="catagoryName"></u-search>
<scroll-view
v-if="dropDown"
class="wyb-drop-down-content"
:class="[dropOver ? 'wyb-drop-down-content-active' : '']"
:scroll-y="scroll"
:enable-flex="true"
:scroll-anchoring="true"
:style="{
zIndex: zIndex - 1,
fontSize: fontSize.content + 'rpx',
backgroundColor: bgColor.content,
borderBottomLeftRadius: radius + 'px',
borderBottomRightRadius: radius + 'px',
minHeight: minHeight + 'rpx',
height: autoHeight ? 'auto' : minHeight + 'rpx',
maxHeight: autoHeight && maxHeight ? maxHeight + 'rpx' : 'auto'}">
<view class="wyb-drop-down-content-box" v-for="(item,index) in options" :key="contentBoxKey(index)">
<view v-if="item['custom'] && headerActiveIndex === index && dropDown" class="wyb-drop-down-content-slot">
<slot></slot>
</view>
<view
v-if="!item['custom'] && headerActiveIndex === index && dropDown"
class="wyb-drop-down-content-item"
v-for="(content,zIndex) in item['contents']"
:key="content"
@tap.stop="onContentItemsTap(zIndex)">
<text
class="wyb-drop-down-content-item-label"
:style="{color: contentActiveIndexList[headerActiveIndex]['index'] === zIndex && dropOver ? activeColor: defaultColor}">
{{content}}
</text>
<text
v-if="contentActiveIndexList[headerActiveIndex]['index'] === zIndex && dropOver"
:style="{color: activeColor}"
class="iconfont icon-selected wyb-drop-down-content-item-icon" />
<view class="wyb-drop-down-line" v-if="zIndex !== options[headerActiveIndex].contents.length - 1" />
</view>
</view>
</scroll-view>
</view>
<view
@ -236,6 +237,7 @@
methods: {
searchHandle(){
console.log(this.catagoryName,"uuu")
this.$emit('getContent',this.catagoryName)
},
clickHandle(){
this.disabled = false;
@ -317,15 +319,19 @@
/* #endif */
left: 0;
right: 0;
display: flex;
/* display: flex; */
flex-direction: row;
background-color: #fff;
z-index: 500;
}
.headercontainer{
position: relative;
z-index: 500;
background-color: #ffffff;
}
.wyb-drop-down-header-item {
border:1px solid blue;
position:relative;
flex: 1;
height: 100rpx;
@ -439,7 +445,7 @@
.withSearch{
position:absolute;
z-index:999;
top:110upx;
top:20upx;
right:24upx;
width:180upx;
height:70upx;

@ -21,7 +21,8 @@
},
/* */
"modules" : {
"OAuth" : {}
"OAuth" : {},
"Camera" : {}
},
/* */
"distribute" : {

@ -32,6 +32,7 @@
drop-icon="line"
:options="options"
defaultColor="#0076F6"
@getContent="getContent"
>
<view class="tagList">
<view :class="active==index?'tagItem active':'tagItem'"
@ -55,13 +56,19 @@
</view>
</view>
<view :class="noSearch?'nosearchListContent marginTop':'nosearchListContent'">
<view v-if="contentList.length>0" :class="noSearch?'nosearchListContent marginTop':'nosearchListContent'">
<view class="firstItem" v-for="item in contentList"
:key="item.id" @click="goNextSection(item)">
<text>{{item.name}}</text>
<text>{{item.subName}}</text>
</view>
</view>
<view class="nodata" v-if="contentList.length==0">
<image src="../../static/nodata.png" mode="widthFix"></image>
<view class="empty">
暂无数据
</view>
</view>
</view>
</template>
@ -94,6 +101,10 @@ export default{
this.getListData(option.id)
},
methods:{
getContent(val){
this.catagoryName = val;
this.getListData(this.catagoryId)
},
searchHandle(){
this.getListData(this.catagoryId)
},
@ -160,7 +171,6 @@ export default{
}
.searchBox{
position:relative;
border:1px solid red;
}
.withSearch{
position:absolute;
@ -223,4 +233,12 @@ export default{
color: #0076F6 !important;
}
}
.nodata{
margin-top:200rpx;
text-align: center;
image{
width:30%;
height:auto;
}
}
</style>

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Loading…
Cancel
Save