微信小程序?qū)崿F(xiàn)點(diǎn)擊圖片旋轉(zhuǎn)180度并且彈出下拉列表
更新時間:2018年11月27日 16:58:08 作者:a_靖
這篇文章主要為大家詳細(xì)介紹了微信小程序?qū)崿F(xiàn)點(diǎn)擊圖片旋轉(zhuǎn)180度并且彈出下拉列表,具有一定的參考價值,感興趣的小伙伴們可以參考一下
本文為大家分享了微信小程序?qū)崿F(xiàn)圖片旋轉(zhuǎn)、下拉列表的具體代碼,供大家參考,具體內(nèi)容如下
正文:
先上效果圖:

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
Page({
data:{
selectPerson:true,
firstPerson:'個人',
selectArea:false,
},
//點(diǎn)擊選擇類型
clickPerson:function(){
var selectPerson = this.data.selectPerson;
if(selectPerson == true){
this.setData({
selectArea:true,
selectPerson:false,
})
}else{
this.setData({
selectArea:false,
selectPerson:true,
})
}
} ,
//點(diǎn)擊切換
mySelect:function(e){
this.setData({
firstPerson:e.target.dataset.me,
selectPerson:true,
selectArea:false,
})
},
}}
index.wxss
.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)圖片。
}
以上就是本文的全部內(nèi)容,希望對大家的學(xué)習(xí)有所幫助,也希望大家多多支持腳本之家。
您可能感興趣的文章:
相關(guān)文章
ES6 Class中實(shí)現(xiàn)私有屬性的一些方法總結(jié)
這篇文章主要給大家介紹了關(guān)于ES6 Class中實(shí)現(xiàn)私有屬性的一些方法,文中通過示例代碼介紹的非常詳細(xì),對大家學(xué)習(xí)或者使用ES6具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起學(xué)習(xí)學(xué)習(xí)吧2019-07-07
JS在可編輯的div中的光標(biāo)位置插入內(nèi)容的方法
這篇文章主要介紹了JS在可編輯的div中的光標(biāo)位置插入內(nèi)容的方法,分別用js與jQuery兩種方式加以實(shí)現(xiàn),是非常實(shí)用的特效技巧,需要的朋友可以參考下2014-11-11
js實(shí)現(xiàn)調(diào)用網(wǎng)絡(luò)攝像頭及常見錯誤處理
這篇文章主要介紹了js實(shí)現(xiàn)調(diào)用網(wǎng)絡(luò)攝像頭及常見錯誤處理,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧2021-03-03
bootstrap中使用google prettify讓代碼高亮的方法
使用google prettify 讓代碼高亮非常漂亮,接下來通過本文給大家介紹bootstrap中使用google prettify讓代碼高亮的方法,感興趣的朋友一起看看吧2016-10-10

