标签属性
以下重点说明本 Todo 中使用到的, 其他具体请移步小程序官方文档 https://developers.weixin.qq.com/miniprogram/dev/component
1.input 的 placeholder 的样式, 有专门的属性 placeholder-class, 如下:
<input placeholder-class="phcolor" placeholder='What needs to be done?' focus="{{focus}}" value="{{ inputVal }}" />
2.checkbox 及 for 循环:
checkbox 的状态变换, 无法直接操作 checkbox, 需要在 checkbox-group 上面操作,
wx:for 循环需加上 wx:key
- <view class=""wx:for="{{ showLists }}"wx:key="index">
- <checkbox-group bindchange="checked" data-id="{{item.id}}">
- <checkbox value="{{ item.value }}" checked="{{ item.check }}"></checkbox>
- </checkbox-group>
- </view>
3.hidden 属性: 隐藏标签, 标签全可用
<view hidden="{{ hidden }}"></view>
4. 自定义属性: data-
- <text data-type="all" class="{{ dataType=='all'?'on':'' }}"bindtap="changeType">All</text>
- changeType(e){
- //js 中获取 data-type 的值
- let dataType = e.target.dataset.type
- }
来源: https://www.cnblogs.com/shenmissing/p/8885819.html