一、picker-view / picker-view-column

<view>
<view>{{year}}年{{month}}月{{day}}日</view>
<picker-view indicator-style="height: 50px;" style="width: 100%; height: 300px;" value="{{value}}" bindchange="bindChange">
<picker-view-column>
<view wx:for="{{years}}" style="line-height: 50px"wx:key="">{{item}}年</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{months}}" style="line-height: 50px"wx:key="">{{item}}月</view>
</picker-view-column>
<picker-view-column>
<view wx:for="{{days}}" style="line-height: 50px" wx:key="">{{item}}日</view>
</picker-view-column>
</picker-view>
</view>
<!--
value Array.<number> 数组中的数字依次表示 picker-view 内的 picker-view-column 选择的第几项(下标从 开始),数字大于 picker-view-column 可选项长度时,选择最后一项。 1.0.
indicator-style string 设置选择器中间选中框的样式 1.0.
indicator-class string 设置选择器中间选中框的类名 1.1.
mask-style string 设置蒙层的样式 1.5.
mask-class string 设置蒙层的类名 1.5.
bindchange eventhandle 滚动选择时触发change事件,event.detail = {value};value为数组,表示 picker-view 内的 picker-view-column 当前选择的是第几项(下标从 开始) 1.0.
bindpickstart eventhandle 当滚动选择开始时候触发事件 2.3.
bindpickend eventhandle 当滚动选择结束时候触发事件
-->
//index.js
//获取应用实例
const date = new Date()
const years = []
const months = []
const days = [] for (let i = ; i <= date.getFullYear(); i++) {
years.push(i)
} for (let i = ; i <= ; i++) {
months.push(i)
} for (let i = ; i <= ; i++) {
days.push(i)
} Page({
data: {
years: years,
year: date.getFullYear(),
months: months,
month: ,
days: days,
day: ,
value: [, , ],
// 数组中的三个元素分别表示:1、年份下标、月份下标、日期下标
},
bindChange: function (e) {
const val = e.detail.value
this.setData({
year: this.data.years[val[]],
month: this.data.months[val[]],
day: this.data.days[val[]]
})
}
})

二、textarea

<view class="content">
</view>
<view class="section">
<textarea bindblur="bindTextAreaBlur" auto-height placeholder="自动变高" />
</view>
<view class="section">
<textarea placeholder="placeholder颜色是红色的" placeholder-style="color:red;" />
</view>
<view class="section">
<textarea placeholder="这是一个可以自动聚焦的textarea" auto-focus />
</view>
<view class="section">
<textarea placeholder="这个只有在按钮点击的时候才聚焦" focus="{{focus}}" />
<view class="btn-area">
<button bindtap="bindButtonTap">使得输入框获取焦点</button>
</view>
</view>
<view class="section">
<form bindsubmit="bindFormSubmit">
<textarea placeholder="form 中的 textarea" name="textarea" />
<button form-type="submit"> 提交 </button>
</form>
</view>
<!--
value string 输入框的内容 1.0.
placeholder string 输入框为空时占位符 1.0.
placeholder-style string 指定 placeholder 的样式,目前仅支持color,font-size和font-weight 1.0.
placeholder-class string textarea-placeholder 否 指定 placeholder 的样式类 1.0.
disabled boolean 是否禁用 1.0.
maxlength number 最大输入长度,设置为 - 的时候不限制最大长度 1.0.
auto-focus boolean 自动聚焦,拉起键盘。 1.0.
focus boolean 获取焦点 1.0.
auto-height boolean 是否自动增高,设置auto-height时,style.height不生效 1.0.
fixed boolean false 如果 textarea 是在一个 position:fixed 的区域,需要显示指定属性 fixed 为 true 1.0.
cursor-spacing number 指定光标与键盘的距离。取textarea距离底部的距离和cursor-spacing指定的距离的最小值作为光标与键盘的距离
cursor number 指定focus时的光标位置 1.5.
show-confirm-bar boolean 是否显示键盘上方带有”完成“按钮那一栏 1.6.
selection-start number 光标起始位置,自动聚集时有效,需与selection-end搭配使用 1.9.
selection-end number 光标结束位置,自动聚集时有效,需与selection-start搭配使用 1.9.
adjust-position boolean 键盘弹起时,是否自动上推页面 1.9.
bindfocus eventhandle 输入框聚焦时触发,event.detail = { value, height },height 为键盘高度,在基础库 1.9. 起支持
bindblur eventhandle 输入框失去焦点时触发,event.detail = {value, cursor} 1.0.
bindlinechange eventhandle 输入框行数变化时调用,event.detail = {height: , heightRpx: , lineCount: } 1.0.
bindinput eventhandle 当键盘输入时,触发 input 事件,event.detail = {value, cursor, keyCode},keyCode 为键值,目前工具还不支持返回keyCode参数。bindinput 处理函数的返回值并不会反映到 textarea 上 1.0.
bindconfirm eventhandle 点击完成时, 触发 confirm 事件,event.detail = {value: value} 1.0.
bindkeyboardheightchange eventhandle 键盘高度发生变化的时候触发此事件,event.detail = {height: height, duration: duration
-->
//textarea.js
Page({
data: {
height: ,
focus: false
},
bindButtonTap: function () {
this.setData({
focus: true
})
},
bindTextAreaBlur: function (e) {
console.log(e.detail.value)
},
bindFormSubmit: function (e) {
console.log(e.detail.value.textarea)
}
})

微信小程序开发--组件(4)的更多相关文章

  1. 微信小程序开发--组件(5)

    一.editor 富文本编辑器,可以对图片.文字进行编辑. 编辑器导出内容支持带标签的 html和纯文本的 text,编辑器内部采用 delta 格式进行存储. 通过setContents接口设置内容 ...

  2. 微信小程序开发--组件(3)

    一.radio <radio-group class="radio-group" bindchange="radioChange"> <lab ...

  3. 微信小程序开发05-日历组件的实现

    接上文:微信小程序开发04-打造自己的UI库 github地址:https://github.com/yexiaochai/wxdemo 我们这里继续实现我们的日历组件,这个日历组件稍微有点特殊,算是 ...

  4. 微信小程序开发03-这是一个组件

    编写组件 基本结构 接上文:微信小程序开发02-小程序基本介绍 我们今天先来实现这个弹出层: 之前这个组件是一个容器类组件,弹出层可设置载入的html结构,然后再设置各种事件即可,这种组件有一个特点: ...

  5. 微信小程序倒计时组件开发

    今天给大家带来微信小程序倒计时组件具体开发步骤: 先来看下最终效果: git源:http://git.oschina.net/dotton/CountDown 分步骤-性子急的朋友,可以直接看最后那段 ...

  6. 微信小程序开发心得

    微信小程序也已出来有一段时间了,最近写了几款微信小程序项目,今天来说说感受. 首先开发一款微信小程序,最主要的就是针对于公司来运营的,因为,在申请appid(微信小程序ID号)时候,需要填写相关的公司 ...

  7. 微信小程序开发日记——高仿知乎日报(下)

    本人对知乎日报是情有独钟,看我的博客和github就知道了,写了几个不同技术类型的知乎日报APP 要做微信小程序首先要对html,css,js有一定的基础,还有对微信小程序的API也要非常熟悉 我将该 ...

  8. 微信小程序开发日记——高仿知乎日报(中)

    本人对知乎日报是情有独钟,看我的博客和github就知道了,写了几个不同技术类型的知乎日报APP要做微信小程序首先要对html,css,js有一定的基础,还有对微信小程序的API也要非常熟悉 我将该教 ...

  9. 微信小程序开发日记——高仿知乎日报(上)

    本人对知乎日报是情有独钟,看我的博客和github就知道了,写了几个不同技术类型的知乎日报APP 要做微信小程序首先要对html,css,js有一定的基础,还有对微信小程序的API也要非常熟悉 我将该 ...

随机推荐

  1. epplus输出成thml

    using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.We ...

  2. ADO.NET基础开发

    ADO.NET是微软新一代.NET数据库的访问架构,ADO是ActiveX Data Objects的缩写.ADO.NET是数据库应用程序和数据源之间沟通的桥梁,主要提供了一个面向对象的数据访问架构, ...

  3. 零元学Expression Blend 4 - Chapter 13 用实例了解布局容器系列-「Pathlistbox」I

    原文:零元学Expression Blend 4 - Chapter 13 用实例了解布局容器系列-「Pathlistbox」I 本系列将教大家以实做案例认识Blend 4 的布局容器,此章介绍的布局 ...

  4. 利用BLCR加速android的启动(android4.2)

    BOSS要求提高安卓系统的启动速度,优化bootloader和kernel后,发现还是达不到要求,没办法才打起zygote的注意. ================================== ...

  5. Arch Linux 是个 针对 i686 优化的 Linux 发行版(通过可以轻松使用的二进制包系统 - pacman)

    Arch Linux 是个 针对 i686 优化的 Linux 发行版(通过可以轻松使用的二进制包系统 - pacman)Arch 同时也拥有一个类似 ports 的包构建系统(Arch Build ...

  6. QT5.8 VS2017 编译教程(可以使用VS2017 XP兼容包)

    1.下载QT5.8源码 这个我不做过多解释. 2.安装使用的环境 visual studio 2017  Python Perl  Ruby 安装好,并配置好环境PATH变量. 3.修改错误代码 错误 ...

  7. MFC中的模态对话框与非模态对话框,模态对话框测试

    http://blog.csdn.net/u010839382/article/details/52972427 http://blog.csdn.net/u010839382/article/det ...

  8. asp.net mvc下实现微信公众号(JsApi)支付介绍

    本文主要讲解asp.net mvc框架下公众号支付如何实现,公众号支付主要包括三个核心代码,前台调起支付js代码.对应js调用参数参数生成代码.支付成功处理代码. 一.微信支付方式介绍 微信提供了各种 ...

  9. 11 CSS的三种引入方式和基本选择器

    <!-- 整体说明: 1.CSS的三种引入方式 (1)行内样式 (2)内接样式 (3)外接样式 2.CSS的基本选择器 (1)id选择器 (引用方式:#id) (2)标签选择器(引用方式:标签名 ...

  10. 【dateFormatSymbols】JAVA特殊日期格式转换

    记录:特殊日期格式转换,如将yyyyMMdd转为01MAY2019 public static final String DATE_VIP_FORMAT = "yyyyMMdd"; ...