123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324 |
-
- <title>layDate 功能演示一</title>
- <div class="layui-card layadmin-header">
- <div class="layui-breadcrumb" lay-filter="breadcrumb">
- <a lay-href="">主页</a>
- <a><cite>组件</cite></a>
- <a><cite>日期时间</cite></a>
- </div>
- </div>
-
- <div class="layui-fluid">
- <div class="layui-row layui-col-space15">
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-header">常规用法</div>
- <div class="layui-card-body" pad15>
-
- <div class="layui-form">
- <div class="layui-form-item">
- <div class="layui-inline">
- <label class="layui-form-label">中文版</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-normal-cn" placeholder="yyyy-MM-dd">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">国际版</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-normal-en" placeholder="yyyy-MM-dd">
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </div>
-
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-header">五大选择器</div>
- <div class="layui-card-body" pad15>
-
- <div class="layui-form" wid100>
- <div class="layui-form-item">
- <div class="layui-inline">
- <label class="layui-form-label">年选择器</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-type-year" placeholder="yyyy">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">年月选择器</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-type-month" placeholder="yyyy-MM">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">日期选择器</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-type-date" placeholder="yyyy-MM-dd">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">时间选择器</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-type-time" placeholder="HH:mm:ss">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">日期时间选择器</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-type-datetime" placeholder="yyyy-MM-dd HH:mm:ss">
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </div>
-
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-header">范围选择</div>
- <div class="layui-card-body" pad15>
-
- <div class="layui-form" wid100>
- <div class="layui-form-item">
- <div class="layui-inline">
- <label class="layui-form-label">日期范围</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-range-date" placeholder=" - ">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">年范围</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-range-year" placeholder=" - ">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">年月范围</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-range-month" placeholder=" - ">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">时间范围</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-range-time" placeholder=" - ">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">日期时间范围</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-range-datetime" placeholder=" - ">
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </div>
-
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-header">自定义格式</div>
- <div class="layui-card-body" pad15>
-
- <div class="layui-form" wid100>
- <div class="layui-form-item">
- <div class="layui-inline">
- <label class="layui-form-label">请选择日期</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-format-date1" placeholder="yyyy年MM月dd日">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">请选择日期</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-format-date2" placeholder="dd/MM/yyyy">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">请选择月份</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-format-month" placeholder="yyyyMM">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">请选择时间</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-format-time" placeholder="H点m分">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">请选择范围</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-format-range1" placeholder=" ~ ">
- </div>
- </div>
- <div class="layui-inline">
- <label class="layui-form-label">请选择范围</label>
- <div class="layui-input-inline">
- <input type="text" class="layui-input" id="test-laydate-format-range2" placeholder="开始 到 结束">
- </div>
- </div>
- </div>
- </div>
-
- </div>
- </div>
- </div>
-
- <div class="layui-col-md12">
- <div class="layui-card">
- <div class="layui-card-header">同时绑定多个</div>
- <div class="layui-card-body" pad15>
- <div class="layui-form" wid100>
- <div class="layui-form-item">
- <div class="layui-inline">
- <input type="text" class="layui-input test-laydate-item" placeholder="yyyy-MM-dd">
- </div>
- <div class="layui-inline">
- <input type="text" class="layui-input test-laydate-item" placeholder="yyyy-MM-dd">
- </div>
- <div class="layui-inline">
- <input type="text" class="layui-input test-laydate-item" placeholder="yyyy-MM-dd">
- </div>
- </div>
- </div>
- </div>
- </div>
- </div>
-
-
-
- </div>
- </div>
-
- <script>
- layui.use(['admin', 'laydate'], function(){
- var laydate = layui.laydate;
-
- //示例代码
-
- //常规用法
- laydate.render({
- elem: '#test-laydate-normal-cn'
- });
-
- //国际版
- laydate.render({
- elem: '#test-laydate-normal-en'
- ,lang: 'en'
- });
-
- //年选择器
- laydate.render({
- elem: '#test-laydate-type-year'
- ,type: 'year'
- });
-
- //年月选择器
- laydate.render({
- elem: '#test-laydate-type-month'
- ,type: 'month'
- });
-
- //日期选择器
- laydate.render({
- elem: '#test-laydate-type-date'
- //,type: 'date' //type 默认为 date,所以可不填
- });
-
- //时间选择器
- laydate.render({
- elem: '#test-laydate-type-time'
- ,type: 'time'
- });
-
- //日期时间选择器
- laydate.render({
- elem: '#test-laydate-type-datetime'
- ,type: 'datetime'
- });
-
- //日期范围
- laydate.render({
- elem: '#test-laydate-range-date'
- ,range: true
- });
-
- //年范围
- laydate.render({
- elem: '#test-laydate-range-year'
- ,type: 'year'
- ,range: true
- });
-
- //年月范围
- laydate.render({
- elem: '#test-laydate-range-month'
- ,type: 'month'
- ,range: true
- });
-
- //时间范围
- laydate.render({
- elem: '#test-laydate-range-time'
- ,type: 'time'
- ,range: true
- });
-
- //日期时间范围
- laydate.render({
- elem: '#test-laydate-range-datetime'
- ,type: 'datetime'
- ,range: true
- });
-
- //自定义格式
- laydate.render({
- elem: '#test-laydate-format-date1'
- ,format: 'yyyy年MM月dd日'
- });
- laydate.render({
- elem: '#test-laydate-format-date2'
- ,format: 'dd/MM/yyyy'
- });
- laydate.render({
- elem: '#test-laydate-format-month'
- ,type: 'month'
- ,format: 'yyyyMM'
- });
- laydate.render({
- elem: '#test-laydate-format-time'
- ,type: 'time'
- ,format: 'H点m分'
- });
- laydate.render({
- elem: '#test-laydate-format-range1'
- ,range: '~'
- });
- laydate.render({
- elem: '#test-laydate-format-range2'
- ,type: 'datetime'
- ,range: '到'
- ,format: 'yyyy年M月d日H时m分s秒'
- });
-
- //同时绑定多个
- lay('.test-laydate-item').each(function(){
- laydate.render({
- elem: this
- ,trigger: 'click'
- });
- });
-
- });
- </script>
|