picker
v0.9+
概述
以下为 picker 相关的 API,用于数据选择,日期选择,时间选择。
API
pick(options, callback[options])
调用单选 picker
参数
options {Object}:调用单选 picker 选项index {number}:默认选中的选项items {array}:picker 数据源textColor {color}:picker中文字的颜色selectionColor {color}:picker中选中item的背景色confirmTitle {string}:确认按钮的文案cancelTitle {string}:取消按钮的文案confirmTitleColor {color}:确认按钮的文字颜色cancelTitleColor {color}:取消按钮的文字颜色title {string}:对话框的标题titleColor {color}:对话框标题的文字颜色titleBackgroundColor {color}:对话框标题的背景色
callback {function (ret)}:执行完读取操作后的回调函数。ret {Object}为callback函数的参数,有两个属性:result {string}:结果三种类型success,cancel,errordata {number}:选择的选项,仅成功确认时候存在。
pickDate(options, callback[options])
调用 date picker
参数
options {Object}:调用 date picker 选项value {string}:必选,date picker 选中的值,date 的字符串格式为yyyy-MM-ddmax {string}:可选,date 的最大值min {string}:可选,date 的最小值
callback {function (ret)}:执行完读取操作后的回调函数。ret {Object}为callback函数的参数,有两个属性:result {string}:结果三种类型success,cancel,errordata {string}:选择的值 date 的字符,格式为yyyy-MM-dd, 仅成功确认的时候存在。
pickTime(options, callback[options])
调用 time picker
参数
options {Object}:调用 time picker 选项value {string}:必选,time 格式为HH:mm
callback {function (ret)}:执行完读取操作后的回调函数。ret {Object}为callback函数的参数,有两个属性:result {string}:结果三种类型success,cancel,errordata {string}:time 格式为HH:mm, 仅成功确认的时候存在。
示例
<template> |