shuxiaoquan 2 years ago
commit 884ce456d5
  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="{ :style="{
zIndex: zIndex, zIndex: zIndex,
backgroundColor: bgColor.header}"> backgroundColor: bgColor.header}">
<view <view class="headercontainer">
class="wyb-drop-down-header-item" <view
v-for="(item,index) in options" class="wyb-drop-down-header-item"
:key="item.header" v-for="(item,index) in options"
@tap.stop="onHeaderTap(index)" :key="item.header"
:style="{fontSize: fontSize.header + 'rpx'}"> @tap.stop="onHeaderTap(index)"
<text :style="{fontSize: fontSize.header + 'rpx'}">
class="wyb-drop-down-header-item-label" <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="{ :style="{
fontWeight: headerActiveIndex === index && dropOver && activeWeight ? 'bold' : 'normal', zIndex: zIndex - 1,
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}">{{item.header}}</text> fontSize: fontSize.content + 'rpx',
<text backgroundColor: bgColor.content,
v-if="dropIcon === 'fill'" borderBottomLeftRadius: radius + 'px',
class="iconfont icon-down-fill wyb-drop-down-header-item-icon" borderBottomRightRadius: radius + 'px',
:class="[headerActiveIndex === index && dropOver ? 'wyb-drop-down-header-item-icon-active' : '']" minHeight: minHeight + 'rpx',
:style="{ height: autoHeight ? 'auto' : minHeight + 'rpx',
fontSize: fontSize.header - 5 + 'rpx', maxHeight: autoHeight && maxHeight ? maxHeight + 'rpx' : 'auto'}">
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}" /> <view class="wyb-drop-down-content-box" v-for="(item,index) in options" :key="contentBoxKey(index)">
<text <view v-if="item['custom'] && headerActiveIndex === index && dropDown" class="wyb-drop-down-content-slot">
v-if="dropIcon==='line'" <slot></slot>
class="iconfont icon-down wyb-drop-down-header-item-icon" </view>
:class="[headerActiveIndex === index && dropOver ? 'wyb-drop-down-header-item-icon-active' : '']" <view
:style="{ v-if="!item['custom'] && headerActiveIndex === index && dropDown"
fontSize: fontSize.header - 5 + 'rpx', class="wyb-drop-down-content-item"
transformOrigin: '50% 45%', v-for="(content,zIndex) in item['contents']"
color: headerActiveIndex === index && dropOver ? activeColor: defaultColor}" /> :key="content"
<view class="wyb-drop-down-vline" v-if="index !== options.length - 1" /></view> @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>
<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>
<view <view
@ -236,6 +237,7 @@
methods: { methods: {
searchHandle(){ searchHandle(){
console.log(this.catagoryName,"uuu") console.log(this.catagoryName,"uuu")
this.$emit('getContent',this.catagoryName)
}, },
clickHandle(){ clickHandle(){
this.disabled = false; this.disabled = false;
@ -317,15 +319,19 @@
/* #endif */ /* #endif */
left: 0; left: 0;
right: 0; right: 0;
display: flex; /* display: flex; */
flex-direction: row; flex-direction: row;
background-color: #fff; background-color: #fff;
z-index: 500; z-index: 500;
} }
.headercontainer{
position: relative;
z-index: 500;
background-color: #ffffff;
}
.wyb-drop-down-header-item { .wyb-drop-down-header-item {
border:1px solid blue;
position:relative; position:relative;
flex: 1; flex: 1;
height: 100rpx; height: 100rpx;
@ -439,7 +445,7 @@
.withSearch{ .withSearch{
position:absolute; position:absolute;
z-index:999; z-index:999;
top:110upx; top:20upx;
right:24upx; right:24upx;
width:180upx; width:180upx;
height:70upx; height:70upx;

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

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

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.3 KiB

Loading…
Cancel
Save