foundation-datepicker-1.5.6 的使用

小弟最近要处理前端页面的一些bug 现在就使用了foundation-datepicker-1.5.6 插件

小结如下,

导入对应插件的包,有js主包,中文插件js,css样式

这个在页面上方

foundation-datepicker.css

下面两个在页面下方也就是</body>下面

foundation-datepicker.js
foundation-datepicker.zh-CN.js

加载的代码

$('#calendar2').fdatepicker({
   format: 'yyyy-mm-dd',
   language : 'zh-CN',
   startDate:BeginTime,
     endDate :endTime,
     leftArrow:'<<',
     rightArrow:'>>',
    datesDisabled:times
    
}).on('changeDate',function (ev) {
          $("#right2").text(format2(ev.date.valueOf(),"yyyy-MM-dd").substring(0,10));
});

属性解释:

常用的 官网文档上值列出了几个。但实际生产使用过程中可能要用到多个,我看了一下源码,才找到一些个别的,仅够我个人使用:

formatstring'mm/dd/yyyy'the date format, combination of d, dd, m, mm, yy, yyyy, hh, ii.
languagestring'en'two-char iso shortcut of language you want to use
weekStartinteger0day of the week start. 0 for Sunday - 6 for Saturday
startViewstring|integermonthset the start view mode. Accepts: 'decade' = 4, 'year' = 3, 'month' = 2, 'day' = 1, 'hour' = 0
minView|maxViewstring|integer set a limit for view mode. Accepts: 'decade' = 4, 'year' = 3, 'month' = 2, 'day' = 1, 'hour' = 0
pickTimebooleanfalseenables hour and minute selection views, equivalent of minView = 0, else minView = 2
initialDatedate stringnullsets initial date. The same effect can be achieved with value attribute on input element.
startDatedate-Infinitydisables all dates before given date
endDatedateInfinitydisables all dates after given date
keyboardNavigationbooleantruewith input fields, allows to navigate the datepicker with arrows. However, it disables navigation inside the input itself, too
daysOfWeekDisabledArray of integers[]disables all dates matching the given days of week (0 = Sunday, 6 = Saturday)
datesDisabledArray of date strings[]disables the specified dates

 以上是官网给出的一些参数,但我在js中还用到了leftArrow rightArrow 这两个参数,是编辑日期插件可以左右换月份的td内容。

.on('changeDate',function (ev) { $("#right2").text(format2(ev.date.valueOf(),"yyyy-MM-dd").substring(0,10));

});

表示添加一个监听器,有选择时,获取选择的日期给到你想显示的位置,这个也是官网示例中的,但翻墙后有时看不到。所以我就记下来了

以上,做个学习笔记

转载于:https://my.oschina.net/u/2543341/blog/1557587

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值