移动端日期插件rolldate

rolldate为上一版jquery移动端时间插件的全新版本,目前保留了上一版的大部分功能,而且增长了回调函数,以及主题风格选取,最重要的是解决了上一版本的遗留问题,依赖jquery、滑动不够流畅、参数设计不够合理等等。
javascript

开发日期选择插件的缘由,一是基于移动端设计的日期选择插件确实很少,二是大多支持的日期格式不够丰富,也不够灵活,这在多变的项目需求中,无疑是捉襟见肘的。
html

rolldate效果图java


支持丰富的日期格式,好比年月、年月日、年月日时分、年月日时分秒,后续还能够扩展其余格式,而且经过一系列回调函数,你能够把日期修改成任意的格式展现,实现日期判断等。jquery

因为有上一版本的积累,rolldate在开发之初就有了完整的设计方案,下面为思惟导图设计git


插件详细的参数如上方思惟导图所示,这里就不过多解释。github

使用方式浏览器

commonJs函数

var rolldate = require('rolldate');
new rolldate.Date({
  el:'#date'
})复制代码
require.js
require(['rolldate'],function(rolldate){
  new rolldate.Date({
    el:'#date'
  })
})复制代码
browser(浏览器直接引入)
new rolldate.Date({
  el:'#date'
})
复制代码
完整调用示例
new rolldate.Date({
    el: '#date',
    format: 'YYYY-MM-DD',
    beginYear: 2000,
    endYear: 2100,
    theme: 'blue',
    tapBefore: function(el) {
        console.log('插件开始触发');
    },
    moveEnd: function(el, iscroll) {
        console.log('滚动结束');
    },
    confirmBefore: function(el, date) {
        console.log('肯定按钮触发');
    },
    confirmEnd: function(el, date) {
        console.log('插件运行结束');
    }
})
复制代码

演示地址(下方附二维码):rolldate,pc端建议使用手机模式打开ui

下载地址:github.com/weijhfly/ro…spa

若是你发现bug或者有更好的建议,欢迎在下方的评论区评论告知,不胜感激。

相关文章
相关标签/搜索