知識
不管是網(wǎng)站,軟件還是小程序,都要直接或間接能為您產(chǎn)生價值,我們在追求其視覺表現(xiàn)的同時,更側(cè)重于功能的便捷,營銷的便利,運營的高效,讓網(wǎng)站成為營銷工具,讓軟件能切實提升企業(yè)內(nèi)部管理水平和效率。優(yōu)秀的程序為后期升級提供便捷的支持!
您當前位置>首頁 » 新聞資訊 » 小程序相關(guān) >
微信小程序?qū)崿F(xiàn)點擊圖片旋轉(zhuǎn)180度并且彈出下拉列表
發(fā)表時間:2021-4-30
發(fā)布人:葵宇科技
瀏覽次數(shù):128
//index.wxml
<view class="phone_one" bindtap="clickPerson">
<view class="phone_personal">{{firstPerson}}</view>
<image src="../../image/v6.png" class="personal_image {{selectArea ? 'rotateRight' :''}}"></image> //三目法判斷圖片要不要旋轉(zhuǎn)180。
</view>
<view class="person_box">
<view class="phone_select" hidden="{{selectPerson}}">
<view bindtap="mySelect">測試1</view>
<view bindtap="mySelect">測試2</view>
<view bindtap="mySelect">測試3</view>
</view>
</view>
//index.js
<pre name="code" class="html">Page({
data:{
selectPerson:true,
firstPerson:'個人',
selectArea:false,
},
//點擊選擇類型
clickPerson:function(){
var selectPerson = this.data.selectPerson;
if(selectPerson == true){
this.setData({
selectArea:true,
selectPerson:false,
})
}else{
this.setData({
selectArea:false,
selectPerson:true,
})
}
} ,
//點擊切換
mySelect:function(e){
this.setData({
firstPerson:e.target.dataset.me,
selectPerson:true,
selectArea:false,
})
},
}}</pre><pre name="code" class="html"></pre>//index.wxss
[html] view plain copy
<pre name="code" class="html">.phone_personal{
width: 100%;
color:rgb(34, 154, 181);
height:100rpx;
line-height:100rpx;
text-align: center;
}
.phone_one{
display: flex; //用flex布局更方便。
position: relative;
justify-content: space-between;
background-color:rgb(239, 239, 239);
width:90%;
height:100rpx;
margin:0 auto;
border-radius: 10rpx;
border-bottom:2rpx solid rgb(255, 255, 255);
}
.person_box{
position: relative;
}
.phone_select{
margin-top:0;
z-index: 100;
position: absolute; //小程序中z-index和absolute需要同時存在,元素才能脫離文檔。
}
.select_one{
text-align: center;
background-color:rgb(239, 239, 239);
width:676rpx; //脫離文檔后元素width不能再用百分比。
height:100rpx;
line-height:100rpx;
margin:0 5%;
border-bottom:2rpx solid rgb(255, 255, 255);
}
.personal_image{
z-index: 100;
position: absolute;
right:2.5%;
width: 34rpx;
height: 20rpx;
margin:40rpx 20rpx 40rpx 0;
transition: All 0.4s ease;
-webkit-transition: All 0.4s ease;
}
.rotateRight{
transform: rotate(180deg); //180°旋轉(zhuǎn)圖片。
}</pre>
<p></p><pre name="code" class="html" style="font-size: 13.3333px;"></pre><p></p>
<pre></pre>
相關(guān)案例查看更多
相關(guān)閱讀
- 全國前十名小程序開發(fā)公司
- web服務(wù)
- 保險網(wǎng)站建設(shè)公司
- 服務(wù)器
- 網(wǎng)站沒排名
- 報廢車
- 昆明網(wǎng)站制作
- 云南網(wǎng)站建設(shè)首選公司
- 百度自然排名
- 云南建設(shè)廳官方網(wǎng)站
- 安家微信小程序
- 退款
- web開發(fā)技術(shù)
- 人口普查小程序
- 云南省建設(shè)廳網(wǎng)站官網(wǎng)
- 搜索排名
- python開發(fā)小程序
- 汽車報廢拆解管理系統(tǒng)
- 云南網(wǎng)站制作
- 小程序
- 網(wǎng)絡(luò)公司哪家好
- 云南小程序制作
- 排名
- 人人商城
- 網(wǎng)站優(yōu)化公司
- 怎么做網(wǎng)站
- 云南小程序開發(fā)
- 云南網(wǎng)站建設(shè)優(yōu)化
- 云南建設(shè)廳網(wǎng)站
- 霸屏推廣