微信小程序点击添加移除class
来源:互联网 发布:网络打印机ip地址查询 编辑:程序博客网 时间:2024/06/05 13:50
微信小程序点击添加移除class类实现动态变化class
wxml:
<view class="location_bottom" hidden="" > <view class="{{_num == 1?'add_citying':'add_city'}}" data-num = "1" bindtap="clickNum">北京</view> <view class="{{_num == 2?'add_citying':'add_city'}}" data-num = "2" bindtap="clickNum">上海</view> </view>
wxss:
.location_bottom{height: 140rpx;line-height: 140rpx;color: #d91f16;font-size: 28rpx;border-top: 2rpx #ebebeb solid; border-bottom: 2rpx #ebebeb solid; padding: 0 20rpx; align-items: center;display: -webkit-flex;}
.add_city{width: 228rpx;height: 60rpx;line-height: 60rpx; text-align: center; border: 2rpx solid #ebebeb; color: #000000;margin-right: 20rpx; }.add_citying{width: 228rpx;height: 60rpx;line-height: 60rpx; text-align: center; border: 2rpx solid #09bb07; color: #09bb07;margin-right: 20rpx;}
js:
Page({ data: { _num: 0, }, clickNum: function (e) { console.log(e.target.dataset.num) this.setData({ _num: e.target.dataset.num }) }, onLoad: function (options) { } })
0 0
- 微信小程序点击添加移除class
- 微信小程序点击移除添加class(点击改变背景颜色和字体颜色)
- jquery点击加class在点击移除添加的class
- jquery点击一组相同的class里的某个 添加或移除class
- javascript添加移除class
- 状态的添加和移除。class
- 微信小程序进度条/icon/添加和移除文字!
- html元素添加和移除class属性
- JavaScript原生添加移除class的方法
- juqery点击元素添加样式同级元素移除样式
- 点击li时添加样式,移除兄弟样式
- 93 添加class 移出class 移除/移出link或style的css规则,不常用
- 判断元素是否含有某个Class值(正则法)移除、添加class
- 在运行时添加和移除事件处理程序
- 添加&移除附件
- a标签跳转到指定div,jquery添加和移除class属性
- Hbuilder MUI用原生js添加或移除class属性
- AngularJS 分页 点击当前页添加样式,其余移除样式
- Leetcode 求买股票的最大盈利问题
- WannaCryptor 勒索蠕虫样本深度技术分析
- webpack代码部署index.html无内容显示
- orale 多行合并为一行
- Android 判断一个字符串是否含有中文
- 微信小程序点击添加移除class
- 关于VMware tools的使用安装 超详细
- 交叉熵tf.nn.softmax_cross_entropy_with_logits的用法
- windows+php7安装laravel
- Linux系统常用基本操作(二)
- jqGrid文档
- telnet不能用!!!提示:-bash: telnet: command not found
- 关于 UART
- RobotFramework内置变量:Built-in Variables(转载)