微信小程序实现点击图片旋转180度并且弹出下拉列表
来源:互联网 发布:扁平疣网络医院 编辑:程序博客网 时间:2024/06/14 01:32
先上效果图:
//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> //三目法判断图片要不要旋转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, }, //点击选择类型 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, }) },}}//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°旋转图片。}
阅读全文
0 0
- 微信小程序实现点击图片旋转180度并且弹出下拉列表
- 点击实现图片旋转缩放
- 微信小程序商品循环列表点击弹出当前的商品信息
- 运用PopWindow实现仿微信弹出下拉列表
- ajax实现点击弹出选择列表
- 实现点击按钮弹出登陆框并且可移动操作
- 点击弹出下拉框
- jquery 点击旋转效果,点击图片旋转360度
- 如何实现ComboBox下拉列表显示图片
- android利用PopupWindow实现点击工具栏弹出下拉菜单
- 微信小程序实现给循环列表添加点击样式
- Ext mvc 下的点击表格后弹出框中有下拉列表框 下拉列表框值如何显示
- 点击旋转图片90度-jquery
- 在程序运行时,点击button旋转图片
- IOS点击文字展开滚轮实现,类似下拉列表
- Android实现RecyclerView自定义列表、点击事件以及下拉刷新
- Android实现RecyclerView自定义列表、点击事件以及下拉刷新
- jQuery点击弹出下拉菜单
- ViewPager 中 StackOverflowError
- 【编程题】Java编程题四(10道)
- 使用VS2012调试ReactOS源码
- c++ && JAVA 的资源回收机制-对比
- React Native顶-底部导航使用小技巧
- 微信小程序实现点击图片旋转180度并且弹出下拉列表
- 公钥加密 私钥解密,私钥数字签名 公钥验证
- java调用Oracle存储过程返回Cursor
- maven导入第三方jar包
- 3.kotlin 类和函数
- Sketch的优点
- iOS 优秀英文系列教程
- solr中solrconfig.xml详解
- spring延迟加载,的配置和使用