bootstrap-datepicker沙箱环境: viewmode=0&maxviewmode=4&todayBtn=false&clearBtn=false&language=en&orientation=auto&multidate=&multidateSeparator=&keyboardNavigation=on&forceParse=on#sandBox">bootstrap-datepicker沙箱环境:
1、requirejs配置
rush:js;">
requirejs.config({
baseUrl: '../pages/modules',// urlArgs: "v=" + (new Date()).getTime(),//禁止缓存,生产环境去除
urlArgs:'v=2016110701',paths: {
jquery: ["../../plugins/jquery/jquery"],bootstrap: ["../../plugins/bootstrap/dist/js/bootstrap.min"],datepicker:["../../plugins/bootstrap-datepicker/dist/js/bootstrap-datepicker.min"],datepicker_zh:["../../plugins/bootstrap-datepicker/dist/locales/bootstrap-datepicker.zh-CN.min"]
},shim: {
bootstrap: {deps: ["jquery"],exports: 'bootstrap'},datepicker:{deps:["jquery"],exports:"datepicker"},datepicker_zh:{deps:["jquery","datepicker"],exports:"datepicker_zh"}
}
});
require(['jquery','bootstrap']);
2 html
rush:xhtml;">
ottom" id="birthdayGroup">
3 js
rush:js;">
var $ = require('jquery');
require('datepicker_zh');
$("#birthdayGroup .input-group.date").datepicker({todayHighlight:true,todayBtn: 'linked',keyboardNavigation:true,autoclose:true,language:'zh-CN',format:'yyyy-mm-dd',daysOfWeekHighlighted:'0,6'});
4 效果
5 更改默认配置
如果每个控件都按照上述js的写法,是不是很痛苦。所以可以将您认为常用的配置设置到
设置完毕后,要做的是日期的格式,因为bootstrap-datepicker.zh-CN.min.js将格式设置为了yyyy年mm月dd日,所以如果您想默认格式为'yyyy-mm-dd',还得改bootstrap-datepicker.zh-CN.min.js这个地方.
现在您只需要即可实现效果。