




版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)
文檔簡(jiǎn)介
【移動(dòng)應(yīng)用開(kāi)發(fā)技術(shù)】小程序中如何實(shí)現(xiàn)彈出菜單功能
這篇文章給大家分享的是有關(guān)小程序中如何實(shí)現(xiàn)彈出菜單功能的內(nèi)容。在下覺(jué)得挺實(shí)用的,因此分享給大家做個(gè)參考,一起跟隨在下過(guò)來(lái)看看吧。需求點(diǎn)擊標(biāo)簽欄按鈕,向下彈出菜單,再次點(diǎn)擊,收回菜單要解決的問(wèn)題標(biāo)簽欄三欄樣式,標(biāo)簽欄固定不動(dòng);點(diǎn)擊標(biāo)簽欄彈出菜單,并且出現(xiàn)透明遮罩;遮罩優(yōu)先級(jí)在彈出框之下;彈出框內(nèi)標(biāo)簽的設(shè)置;滾動(dòng)欄滾動(dòng)條的隱藏如何解決?彈性布局,橫向,三者平分整欄;狀態(tài)監(jiān)聽(tīng)點(diǎn)擊事件,數(shù)據(jù)控制hide或者show,通過(guò)rgba設(shè)置透明度彈出框設(shè)置z-index;彈性布局flex橫向排列超出后wrap然后space-around控制間距::-webkit-scrollbar
{
width:
0;
height:
0;
color:
transparent;
}具體實(shí)現(xiàn)wxml<import
src="../../templates/template"
/>
<view
class="container
{{isMask?'mask':''}}">
<view
class="header">
<view
class="filterCity
{{status=='1'
&&
isActive?'active':''}}"
data-status='1'
bindtap="changeStatus">
<view
class="city">城市篩選</view>
<image
src="{{status=='1'
&&
isActive?'../../youzan-image/red-up.png':'../../youzan-image/down.png'}}"
/>
</view>
<view
class="filterJob
{{status=='2'
&&
isActive?'active':''}}"
data-status='2'
bindtap="changeStatus">
<view
class="job">職位篩選</view>
<image
src="{{status=='2'
&&
isActive?'../../youzan-image/red-up.png':'../../youzan-image/down.png'}}"
/>
</view>
<view
class="filterOrder
{{status=='3'&&
isActive?'active':''}}"
data-status='3'
bindtap="changeStatus">
<view
class="order">排序方式</view>
<image
src="{{status=='3'
&&
isActive?'../../youzan-image/red-up.png':'../../youzan-image/down.png'}}"
/>
</view>
</view>
<block
wx:if="{{isActive==true&&status=='1'}}">
<view
class="cityContainer">
<block
wx:for="{{city}}"
wx:key="id"
wx:for-index="index">
<view
class="city
{{isSelect&&index==curIndex?'select':''}}"
data-index="{{index}}"
bindtap="select">{{item}}</view>
</block>
</view>
</block>
<block
wx:if="{{isActive==true&&status=='2'}}">
<scroll-view
scroll-y="true"
class="posContainer">
<block
wx:for="{{cur}}"
data-index='index'
wx:for-index='index'
wx:key="index">
<view
class="title">{{item.title}}</view>
<view
class="poscontent">
<view
wx:for="{{item.types}}"
wx:for-item="type"
wx:key='id'
wx:for-index="{{index}}"
data-index="{{index}}">
<view
class="tag
{{isSelect&&index==curIndex?'select':''}}"
data-id="{{id}}"
bindtap="multiSelect">{{type}}</view>
</view>
</view>
</block>
<view
class="confirm">
<button
class="weui-btn"
type="warn">確認(rèn)</button>
</view>
</scroll-view>
</block>
<block
wx:if="{{isActive==true&&status=='3'}}">
<view
class="orderContainer">
<view
class="block">智能排序</view>
<view
class="block">時(shí)間排序</view>
<view
class="block">薪資排序</view>
</view>
</block>
<view
class="listContainer"
>
<view
wx:for="{{jobList}}"
wx:key="index"
data-index="{{index}}">
<template
is="list-item"
data="{{...item}}"
/>
</view>
</view>
<view
class="search
"
bindtap="search">
<image
src="../../youzan-image/search.png"
/>
<text>搜索</text>
</view>
</view>wxsspage
{
position:
relative;
width:
100%;
height:
100vh;
}
.header
{
width:
100%;
height:
80rpx;
position:
fixed;
top:
0;
display:
flex;
flex-direction:
row;
justify-content:
space-between;
text-align:
center;
color:
#313131;
font-size:
16px;
border-bottom:
1rpx
solid
#eeeeee;
z-index:
9999;
background-color:
#fff;
}
.filterCity
{
flex:
1;
position:
relative;
height:
80rpx;
line-height:
80rpx;
}
.filterJob
{
position:
relative;
flex:
1;
height:
80rpx;
line-height:
80rpx;
}
.filterOrder
{
position:
relative;
flex:
1;
height:
80rpx;
line-height:
80rpx;
}
.header
image
{
position:
absolute;
right:
15rpx;
top:
26rpx;
width:
30rpx;
height:
30rpx;
}
.active
{
color:
#ef0001;
}
.mask
{
width:
100%;
height:
100%;
position:
fixed;
top:
80rpx;
background-color:
rgba(15,
15,
26,
0.3);
}
.cityContainer
{
display:
flex;
flex-direction:
row;
justify-content:
space-around;
align-items:
space-between;
flex-wrap:
wrap;
width:
100%;
height:
300rpx;
z-index:
999;
background-color:
#fff;
border-bottom:
1rpx
solid
#e9e9e9;
padding-bottom:
130rpx;
}
.cityContainer
.city
{
display:
block;
font-size:
15px;
margin-top:
100rpx;
width:
150rpx;
height:
50rpx;
line-height:
50rpx;
text-align:
center;
border:
1rpx
solid
#e9e9e9;
overflow:
hidden;
}
.select
{
color:
#ffffff;
background-color:
#ed0000;
}
.posContainer
{
height:
980rpx;
width:
100%;
background-color:
#fff;
/*
overflow:auto;
*/
}
::-webkit-scrollbar
{
width:
0;
height:
0;
color:
transparent;
}
.title
{
margin-top:
55rpx;
font-size:
15px;
margin-left:
28rpx;
}
.poscontent
{
width:
100%;
display:
flex;
flex-direction:
row;
justify-content:
flex-start;
flex-wrap:
wrap;
margin-top:
-15rpx;
}
.tag
{
margin-left:
28rpx;
margin-top:
23rpx;
font-size:
13px;
width:
150rpx;
height:
50rpx;
line-height:
50rpx;
text-align:
center;
border:
1rpx
solid
#e9e9e9;
}
.confirm
{
width:
100%;
height:
150rpx;
border:
1rpx
solid
transparent;
background-color:
#fff;
}
.weui-btn
{
position:
fixed;
width:
95%;
bottom:
52rpx;
left:
50%;
transform:
translateX(-50%);
}
.orderContainer
{
display:
flex;
flex-direction:
row;
justify-content:
space-around;
align-items:
center;
background-color:
#fff;
width:
100%;
height:
125rpx;
}
.block
{
font-size:
13px;
width:
200rpx;
height:
50rpx;
line-height:
50rpx;
text-align:
center;
border:
1rpx
solid
#e9e9e9;
}
.search
{
position:
fixed;
bottom:
80rpx;
background-color:
#fff;
right:
25rpx;
width:
150rpx;
height:
75rpx;
line-height:
75rpx;
text-align:
center;
border-radius:
35rpx;
box-shadow:
1rpx
1rpx
7rpx
7rpx
#f5f5f5;
}
.search
image
{
width:
30rpx;
height:
30rpx;
}
.search
text
{
font-size:
15px;
padding-left:
9rpx;
color:
#666666;
}
.listContainer
{
width:
100%;
height:
100%;
margin-top:
80rpx;
}jsimport
category
from
'../../api/employ'
import
jobList
from
'../../api/detail'
Page({
data:
{
curIndex:
'',
isActive:
false,
jobList:[],
cur:
[],
job:
[],
isShow:
true,
status:
0,
isMask:
false,
isSelect:
false,
city:
['全國(guó)',
'杭州',
'北京',
'深圳',
'上海',
'廣州',
'武漢',
'重慶']
},
changeStatus(e)
{
let
status
=
e.currentTarget.dataset.status;
let
cur
=
category;
this.setData({
isActive:
!this.data.isActive,
status:
status,
isMask:
!this.data.isMask,
cur:
cur,
})
},
select(e)
{
let
curIndex
=
e
溫馨提示
- 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
- 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
- 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
- 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
- 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
- 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
- 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。
最新文檔
- 語(yǔ)文-福建省漳州市2025屆高三畢業(yè)班第三次教學(xué)質(zhì)量檢測(cè)(漳州三檢)試題和答案
- 《探索與發(fā)現(xiàn):三角形邊的關(guān)系》(教學(xué)設(shè)計(jì))-2023-2024學(xué)年四年級(jí)下冊(cè)數(shù)學(xué)北師大版
- 鄉(xiāng)村公路養(yǎng)護(hù)合同范例
- 幼兒園小班角色游戲與社會(huì)認(rèn)知計(jì)劃
- 賣(mài)車(chē)正規(guī)交易合同范例
- 高中教師工作計(jì)劃
- 如何在變化中保持年度目標(biāo)的穩(wěn)定計(jì)劃
- 加強(qiáng)行業(yè)知識(shí)的學(xué)習(xí)目標(biāo)計(jì)劃
- 信貸行業(yè)月度個(gè)人工作計(jì)劃
- 社團(tuán)資源整合優(yōu)化計(jì)劃
- 貫入法檢測(cè)混合砂漿計(jì)算表
- 化工技術(shù)研發(fā)崗位職責(zé)
- 物流、倉(cāng)儲(chǔ)危險(xiǎn)源及風(fēng)險(xiǎn)辨識(shí)與評(píng)價(jià)表
- DG-TJ 08-2367-2021 既有建筑外立面整治設(shè)計(jì)標(biāo)準(zhǔn)
- 五金廠公司績(jī)效考核規(guī)則
- 公文流轉(zhuǎn)單(標(biāo)準(zhǔn)模版)
- SJT 05-2023 裝配式建筑標(biāo)準(zhǔn)化產(chǎn)品系列圖集(預(yù)制混凝土樓梯)
- GB/T 6177.2-2000六角法蘭面螺母細(xì)牙
- GB/T 4100-2015陶瓷磚
- 部編人教版語(yǔ)文六年級(jí)下冊(cè)《2 送元二使安西》課件
- 人教版五年級(jí)數(shù)學(xué)下冊(cè)第二單元《奇偶性》教案
評(píng)論
0/150
提交評(píng)論