-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathui_components.html
2946 lines (2473 loc) · 99.8 KB
/
ui_components.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<!DOCTYPE html>
<html lang="zh-CN">
<!-- Meta, title, CSS, favicons, etc. -->
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width initial-scale=1" />
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>UI组件及js库文档</title>
<meta name="description" content="">
<link rel="stylesheet" href="asserts/styles/vendor.min.css">
<link rel="stylesheet" href="asserts/styles/main.css">
<link rel="stylesheet" href="asserts/styles/ui_components.css">
<link rel="stylesheet" href="asserts/styles/jstree.css">
<link rel="shortcut icon" href="asserts/images/favicon.ico" type="image/vnd.microsoft.icon">
<link rel="icon" href="asserts/images/favicon.ico" type="image/vnd.microsoft.icon">
</head>
<body class=" full-width ">
<div id="loader-wrapper">
<div id="loader"></div>
<div class="loader-section section-left"></div>
<div class="loader-section section-right"></div>
</div>
<!-- Docs master nav -->
<header id="header" class="page-topbar">
<!-- start header nav-->
<div class="navbar-fixed">
<nav class="cyan">
<div class="nav-wrapper">
<ul class="left">
<li class="no-hover" id="toggleNav">
<a href="#" data-activates="slide-out" class="menu-sidebar-collapse btn-floating btn-flat btn-medium waves-effect waves-light cyan tooltipped" href="#!" data-position="bottom" data-delay="0" data-tooltip="导航切换"><i class="mdi-navigation-menu"></i>
</a>
</li>
<li>
<h1 class="logo-wrapper">
<a href="index.html" class="brand-logo darken-1">
<span class="logo-text">湖南海航乐游</span>
</a>
</h1>
</li>
</ul>
<ul class="right hide-on-med-and-down">
<li><a href="javascript:void(0);" class="waves-effect waves-block waves-light toggle-fullscreen tooltipped" data-tooltip="全屏"><i class="mdi-action-settings-overscan"></i></a>
</li>
<li>
<!-- Dropdown Trigger -->
<a class="dropdown-button waves-effect waves-block waves-light" data-hover='true' data-beloworigin="true" href="#!" data-activates="dropdown-switch">
<i class="mdi-social-person"><span>用户名</span></i>
</a>
<!-- Dropdown Structure -->
<ul id='dropdown-switch' class='dropdown-content'>
<li><a href="#!">门店用户</a></li>
<li class="divider"></li>
<li><a href="#!">供应商用户</a></li>
</ul>
</li>
<li>
<!-- Dropdown Trigger -->
<a class="dropdown-button waves-effect waves-block waves-light" data-hover='true' data-beloworigin="true" href="#!" data-activates="dropdown-setting">
<i class="mdi-action-settings"></i>
</a>
<!-- Dropdown Structure -->
<ul id='dropdown-setting' class='dropdown-content'>
<li><a href="#!">修改密码</a></li>
<li class="divider"></li>
<li><a href="#!">个人资料</a></li>
</ul>
</li>
<li>
<a href="javascript:void(0);" class="waves-effect waves-block waves-light tooltipped" data-tooltip="退出">
<i class="mdi-action-settings-power"></i>
</a>
</li>
</ul>
</div>
</nav>
</div>
<!-- end header nav-->
</header>
<!-- Page content of course! -->
<div id="main">
<div class="wrapper">
<section id="content" class="hh-min-width">
<div class="breadcrumbs-wrapper">
<div class="container">
<div class="row no-margin">
<div class="col s12">
<h5 class="breadcrumbs-title">UI组件及js库文档</h5>
<ol class="breadcrumb">
<li><a href="index.html">控制面板</a>
</li>
<li class="active">UI组件及js库文档</li>
</ol>
<div class="mini-charts">
<div class="mini-charts-item pink lighten-2">
<div class="count">
余额
<h2>¥987,459,459</h2>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="container">
<div class="row">
<div class="col s12 m9 l10">
<div class="section">
<p class="caption">部分组件效果及代码示例</p>
<div class="row">
<div id="pickdate" class="section scrollspy col s12 ">
<div class="card hh-search-form ">
<div class="card-content">
<span class="card-title green-text text-darken-4">日期选择控件 pickdate</span>
<p class="sub-title">文档链接:<a href="http://amsul.ca/pickadate.js/date/">http://amsul.ca/pickadate.js/date/</a><p>
<div class="row">
<div class="input-field col s6">
<input placeholder="出发日期" id="dsPicker" type="text" class="datepicker no-init">
<label for="start-date">出发日期</label>
</div>
<div class="input-field col s6">
<input id="dePicker" placeholder="到达日期" type="text" class="datepicker no-init">
<label for="arrive-date">到达日期</label>
</div>
</div>
<pre>
<code class="language-html">
<div class="row">
<div class="input-field col s6">
<input placeholder="出发日期" id="dsPicker" type="text" class="datepicker no-init">
<label for="start-date">出发日期</label>
</div>
<div class="input-field col s6">
<input id="dePicker" placeholder="到达日期" type="text" class="datepicker no-init">
<label for="arrive-date">到达日期</label>
</div>
</div>
</code>
</pre>
<pre>
<code class="language-javascript">
var $dsInput = $('#dsPicker').pickadate({
"selectYears": true,
"selectMonths": true,
"min": new Date(),
onSet: function(value) {
dePicker.set('min', new Date(value.select));
}
});
var dsPicker = $dsInput.pickadate('picker');
var $deInput = $('#dePicker').pickadate({
"selectYears": true,
"selectMonths": true,
"min": new Date(),
onSet: function(value) {
// dsPicker.set('max',new Date(value.select));
}
});
var dePicker = $deInput.pickadate('picker');
</code>
</pre>
</div>
</div>
</div>
<div id="jquery_timepicker" class="section scrollspy col s12 ">
<div class="card hh-search-form ">
<div class="card-content">
<span class="card-title green-text text-darken-4">时间选择控件 jquery timepicker</span>
<p class="sub-title">文档链接:<a href="http://jonthornton.github.io/jquery-timepicker/">http://jonthornton.github.io/jquery-timepicker/</a><p>
<div class="row">
<div class="input-field col s6">
<input placeholder="出发时间" id="start-time2" type="text" class="jq-timepicker">
<label for="start-time2">出发时间</label>
</div>
<div class="input-field col s6">
<input id="arrive-time2" placeholder="到达时间" type="text" class="jq-timepicker">
<label for="arrive-time2">到达时间</label>
</div>
</div>
<pre>
<code class="language-html">
<div class="row">
<div class="input-field col s6">
<input placeholder="出发时间" id="start-time2" type="text" class="jq-timepicker">
<label for="start-time2">出发时间</label>
</div>
<div class="input-field col s6">
<input id="arrive-time2" placeholder="到达时间" type="text" class="jq-timepicker">
<label for="arrive-time2">到达时间</label>
</div>
</div>
</code>
</pre>
<pre>
<code class="language-javascript">
$('.jq-timepicker').timepicker({
'timeFormat': 'H:i'
});
</code>
</pre>
</div>
</div>
</div>
<div id="select2" class="section scrollspy col s12 ">
<div class="card ">
<div class="card-content">
<span class="card-title green-text text-darken-4">下拉菜单select2</span>
<p class="sub-title">文档链接:<a href="https://select2.github.io/">https://select2.github.io/</a><p>
<div class="row">
<div class="col s12">
<h6>单选</h6>
<select class="select2" data-placeholder="选择省份">
<option value="1">北京</option>
<option value="2">上海</option>
<option value="3">广东</option>
<option value="4">湖南</option>
<option value="5">湖北</option>
<option value="6">山东</option>
</select>
<pre>
<code class="language-html">
<select class="select2"></select>
</code>
</pre>
<pre>
<code class="language-javascript">
$('.select2').select2();
</code>
</pre>
</div>
</div>
<div class="row">
<div class="col s12">
<h6>多选</h6>
<select class="select2" multiple data-placeholder="选择省份">
<option value="1">北京</option>
<option value="2">上海</option>
<option value="3">广东</option>
<option value="4">湖南</option>
<option value="5">湖北</option>
<option value="6">山东</option>
</select>
<pre>
<code class="language-html">
<select class="select2" multiple></select>
</code>
</pre>
<pre>
<code class="language-javascript">
$('.select2').select2();
</code>
</pre>
</div>
</div>
<div class="row">
<div class="col s12">
<h6>多选标签</h6>
<select class="select2-tags" multiple data-placeholder="选择省份">
<!-- <option value="1">北京</option>
<option value="2">上海</option>
<option value="3">广东</option>
<option value="4">湖南</option>
<option value="5">湖北</option>
<option value="6">山东</option> -->
</select>
<pre>
<code class="language-html">
<select class="select2-tags" multiple></select>
</code>
</pre>
<pre>
<code class="language-javascript">
$('.select2-tags').select2({
tags:true
});
</code>
</pre>
</div>
</div>
</div>
</div>
</div>
<div id="tags_input" class="section scrollspy col s12 ">
<div class="card ">
<div class="card-content">
<span class="card-title green-text text-darken-4">标签输入框 tagsinput</span>
<p class="sub-title">文档链接:<a href="https://github.com/xoxco/jQuery-Tags-Input">https://github.com/xoxco/jQuery-Tags-Input</a><p>
<input type="text" name="mytags" id="tagsinput">
<pre>
<code class="language-html">
<input type="text" name="mytags" id="tagsinput">
</code>
</pre>
<pre>
<code class="language-javascript">
$('#tagsinput').tagsInput({
width:'auto',
height:'auto',
defaultText:'添加一个标签'
});
//其他方法
//添加标签
$('#tagsinput').addTag('foo');
//移除标签
$('#tagsinput').removeTag('bar');
//导入标签列表
$('#tagsinput').importTags('foo,bar,baz');
//重置标签
$('#tagsinput').importTags('');
</code>
</pre>
<input type="text" name="mytags" value="标签1,标签2,标签3,标签4,标签5,标签6" id="tagsinput2">
<pre>
<code class="language-html">
<input type="text" name="mytags" value="标签1,标签2,标签3,标签4,标签5,标签6" id="tagsinput2">
</code>
</pre>
<pre>
<code class="language-javascript">
$('#tagsinput2').tagsInput({
width:'auto',
height:'auto',
defaultText:'添加一个标签'
});
</code>
</pre>
</div>
</div>
</div>
<div id="typeahead" class="section scrollspy col s12 ">
<div class="card ">
<div class="card-content">
<span class="card-title green-text text-darken-4">自动完成 typeahead.js</span>
<p class="sub-title">文档链接:<a href="http://twitter.github.io/typeahead.js/examples/">http://twitter.github.io/typeahead.js/examples/</a><p>
<div class="row hh-add-edit" id="bloodhound">
<dl class="col s12">
<dt><b>供应商</b></dt>
<dd>
<div class="col s8 m6">
<input class="typeahead" type="text">
</div>
</dd>
</dl>
</div>
<pre>
<code class="language-html">
<div class="row hh-add-edit" id="bloodhound">
<dl class="col s12">
<dt><b>供应商</b></dt>
<dd>
<div class="col s8 m6">
<input class="typeahead" type="text">
</div>
</dd>
</dl>
</div>
</code>
</pre>
<pre>
<code class="language-javascript">
var states = ['Alabama', 'Alaska', 'Arizona', 'Arkansas', 'California',
'Colorado', 'Connecticut', 'Delaware', 'Florida', 'Georgia', 'Hawaii',
'Idaho', 'Illinois', 'Indiana', 'Iowa', 'Kansas', 'Kentucky', 'Louisiana',
'Maine', 'Maryland', 'Massachusetts', 'Michigan', 'Minnesota',
'Mississippi', 'Missouri', 'Montana', 'Nebraska', 'Nevada', 'New Hampshire',
'New Jersey', 'New Mexico', 'New York', 'North Carolina', 'North Dakota',
'Ohio', 'Oklahoma', 'Oregon', 'Pennsylvania', 'Rhode Island',
'South Carolina', 'South Dakota', 'Tennessee', 'Texas', 'Utah', 'Vermont',
'Virginia', 'Washington', 'West Virginia', 'Wisconsin', 'Wyoming'
];
// constructs the suggestion engine
var states = new Bloodhound({
datumTokenizer: Bloodhound.tokenizers.whitespace,
queryTokenizer: Bloodhound.tokenizers.whitespace,
// `states` is an array of state names defined in "The Basics"
local: states
});
$('#bloodhound .typeahead').typeahead({
hint: true,
highlight: true,
minLength: 1
},
{
name: 'states',
source: states
});
</code>
</pre>
</div>
</div>
</div>
<div id="multiselect" class="section scrollspy col s12 ">
<div class="card ">
<div class="card-content">
<span class="card-title green-text text-darken-4">双向多选控件 multiselect</span>
<p class="sub-title">文档链接:<a href="http://loudev.com/">http://loudev.com/</a><p>
<select class="" id="my-multiselect" multiple="multiple" name="test[]">
<optgroup label='湖南省'>
<option value="elem_1" selected>长沙市</option>
<option value="elem_2" selected>株洲市</option>
<option value="elem_3" disabled>湘潭市</option>
<option value="elem_4">邵阳市</option>
<option value="elem_5">衡阳市</option>
<option value="elem_6">常德市</option>
</optgroup>
<optgroup label='湖北省'>
<option value="elem_8" selected>武汉市</option>
<option value="elem_9">宜昌市</option>
<option value="elem_10">黄石市</option>
<option value="elem_11">荆州市</option>
<option value="elem_12">荆门市</option>
<option value="elem_13">黄冈市</option>
</optgroup>
<optgroup label='浙江省'>
<option value="elem_15">杭州市</option>
<option value="elem_16">宁波市</option>
<option value="elem_17">温州市</option>
<option value="elem_18">嘉兴市</option>
<option value="elem_19">湖州市</option>
<option value="elem_20">绍兴市</option>
</optgroup>
</select>
<pre>
<code class="language-html">
<select multiple="multiple" class="" id="my-multiselect" name="test[]">
<optgroup label='湖南省'>
<option value="elem_1" selected>长沙市</option>
<option value="elem_2" selected>株洲市</option>
<option value="elem_3">湘潭市</option>
<option value="elem_4">邵阳市</option>
<option value="elem_5">衡阳市</option>
<option value="elem_6">常德市</option>
</optgroup>
<optgroup label='湖北省'>
<option value="elem_8" selected>武汉市</option>
<option value="elem_9">宜昌市</option>
<option value="elem_10">黄石市</option>
<option value="elem_11">荆州市</option>
<option value="elem_12">荆门市</option>
<option value="elem_13">黄冈市</option>
</optgroup>
<optgroup label='浙江省'>
<option value="elem_15">杭州市</option>
<option value="elem_16">宁波市</option>
<option value="elem_17">温州市</option>
<option value="elem_18">嘉兴市</option>
<option value="elem_19">湖州市</option>
<option value="elem_20">绍兴市</option>
</optgroup>
</select>
</code>
</pre>
<pre>
<code class="language-javascript">
$('#my-multiselect').multiSelect({
selectableHeader: "<div class='ms-header clearfix'>可选城市<a class='right selct-all'>全选</a></div>",
selectionHeader: "<div class='ms-header clearfix'>已选城市<a class='right deselct-all'>反选</a></div>",
afterInit: function(ms) {
var that = this,
$selectableBtn = that.$selectableUl.prev().find('.selct-all'),
$selectionBtn = that.$selectionUl.prev().find('.deselct-all');
$selectableBtn.on('click', function(e) {
that.select_all();
});
$selectionBtn.on('click', function(e) {
that.deselect_all();
});
that.$selectableUl.perfectScrollbar();
that.$selectionUl.perfectScrollbar();
}
});
</code>
</pre>
<h6>单选</h6>
<select class="" id="my-multiselect1" multiple="multiple" name="test[]">
<optgroup label='湖南省'>
<option value="elem_1">长沙市</option>
<option value="elem_2">株洲市</option>
<option value="elem_3" disabled>湘潭市</option>
<option value="elem_4">邵阳市</option>
<option value="elem_5">衡阳市</option>
<option value="elem_6">常德市</option>
</optgroup>
<optgroup label='湖北省'>
<option value="elem_8">武汉市</option>
<option value="elem_9">宜昌市</option>
<option value="elem_10">黄石市</option>
<option value="elem_11">荆州市</option>
<option value="elem_12">荆门市</option>
<option value="elem_13">黄冈市</option>
</optgroup>
<optgroup label='浙江省'>
<option value="elem_15">杭州市</option>
<option value="elem_16">宁波市</option>
<option value="elem_17">温州市</option>
<option value="elem_18">嘉兴市</option>
<option value="elem_19">湖州市</option>
<option value="elem_20">绍兴市</option>
</optgroup>
</select>
<pre><code class="language-javascript">
$('#my-multiselect1').multiSelect({
selectableHeader: "<div class='ms-header clearfix'>可选城市</div>",
selectionHeader: "<div class='ms-header clearfix'>已选城市</div>",
afterInit: function(ms) {
var that = this;
that.$selectableUl.perfectScrollbar();
that.$selectionUl.perfectScrollbar();
},
afterSelect: function(msValue){
var ms = this.$element,
values = ms.val();
values.splice(values.indexOf(msValue[0]),1);
this.deselect(values);
}
});
</code></pre>
</div>
</div>
</div>
<div id="umeditor" class="section scrollspy col s12 ">
<div class="card ">
<div class="card-content">
<span class="card-title green-text text-darken-4">百度编辑框UMeditor</span>
<p class="sub-title">文档链接:<a href="http://ueditor.baidu.com/website/umeditor.html">http://ueditor.baidu.com/website/umeditor.html</a><p>
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor" style="width:50%;height:240px;">
</script>
<pre>
<code class=" language-html">
<!--style给定宽度可以影响编辑器的最终宽度-->
<script type="text/plain" id="myEditor" style="width:50%;height:240px;">
</script>
</code>
</pre>
<pre>
<code class=" language-javascript">
<script src="src/path/umeditor.min.js"></script>
//实例化编辑器到id为 container 的 dom 容器上
var um = UM.getEditor('myEditor');
//设置编辑器内容
um.ready(function() {
um.setContent('<p>hello!</p>');
});
//追加编辑器内容
ue.ready(function() {
ue.setContent('<p>new text</p>', true);
});
//获取编辑器html内容
ue.ready(function() {
var html = ue.getContent();
});
</code>
</pre>
</div>
</div>
</div>
<div id="clndr" class="section scrollspy col s12 ">
<div class="card ">
<div class="card-content">
<span class="card-title green-text text-darken-4">日历控件 clndr</span>
<p class="sub-title">文档链接:<a href="http://kylestetz.github.io/CLNDR/">http://kylestetz.github.io/CLNDR/</a><p>
<div class="full-clndr clearfix">
<script type="text/template" id="full-clndr-template">
<div class="clndr-controls">
<div class="clndr-previous-button"><</div>
<div class="clndr-next-button">></div>
<div class="current-month"><%= month %> <%= year %></div>
</div>
<div class="clndr-grid">
<div class="days-of-the-week clearfix">
<% _.each(daysOfTheWeek, function(day) { %>
<div class="header-day"><%= day %></div>
<% }); %>
</div>
<div class="days">
<% _.each(days, function(day) { %>
<div class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span>
</div>
<% }); %>
</div>
</div>
<div class="event-listing">
<div class="event-listing-title">EVENTS THIS MONTH</div>
<% _.each(eventsThisMonth, function(event) { %>
<div class="event-item">
<div class="event-item-name"><%= event.title %></div>
<div class="event-item-location"><%= event.location %></div>
</div>
<% }); %>
</div>
</script>
</div>
<pre><code class="language-html">
<div class="full-clndr clearfix">
<script type="text/template" id="full-clndr-template">
<div class="clndr-controls">
<div class="clndr-previous-button"><</div>
<div class="clndr-next-button">></div>
<div class="current-month"><%= month %> <%= year %></div>
</div>
<div class="clndr-grid">
<div class="days-of-the-week clearfix">
<% _.each(daysOfTheWeek, function(day) { %>
<div class="header-day"><%= day %></div>
<% }); %>
</div>
<div class="days">
<% _.each(days, function(day) { %>
<div class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span></div>
<% }); %>
</div>
</div>
<div class="event-listing">
<div class="event-listing-title">EVENTS THIS MONTH</div>
<% _.each(eventsThisMonth, function(event) { %>
<div class="event-item">
<div class="event-item-name"><%= event.title %></div>
<div class="event-item-location"><%= event.location %></div>
</div>
<% }); %>
</div>
</script>
</div>
</code></pre>
<pre><code class="language-javascript">
// this will use clndr's default template, which you probably don't want.
$('#calendar').clndr();
// so instead, pass in your template as a string!
$('#calendar').clndr({
template: $('#calendar-template').html()
});
// there are a lot of options. the rabbit hole is deep.
$('#calendar').clndr({
template: $('#calendar-template').html(),
events: [
{ date: '2013-09-09', title: 'CLNDR GitHub Page Finished', url: 'http://github.com/kylestetz/CLNDR' }
],
clickEvents: {
click: function(target) {
console.log(target);
},
onMonthChange: function(month) {
console.log('you just went to ' + month.format('MMMM, YYYY'));
}
},
doneRendering: function() {
console.log('this would be a fine place to attach custom event handlers.');
}
});
</code></pre>
<div class="my-clndr">
<script type="text/template" id="my-clndr-template">
<div class="clndr-controls">
<div class="clndr-previous-button"><</div>
<div class="clndr-next-button">></div>
<div class="current-month"><b><%= year %></b> <%= month %></div>
</div>
<table class="clndr-grid">
<thead class="days-of-the-week">
<tr>
<% _.each(daysOfTheWeek, function(day) { %>
<th class="header-day"><%= day %></th>
<% }); %>
</tr>
</thead>
<tbody class="days">
<% _.each(days, function(day,index) { %>
<% if((index+1)%7 == 1) { %>
<tr>
<% } %>
<td class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span>
<% if(day.events.length && day.events[0].price ){ %>
<span class="dya-price">¥<%= day.events[0].price %> </span>
<% if(day.events[0].isActivity) { %>
<span class="day-activity">优惠</span>
<% } %>
<% } %>
</td>
<% if((index+1)%7 == 0) { %>
</tr>
<% } %>
<% }); %>
</tbody>
</table>
</script>
</div>
<pre><code class="language-html">
<div class="my-clndr">
<script type="text/template" id="my-clndr-template">
<div class="clndr-controls">
<div class="clndr-previous-button"><</div>
<div class="clndr-next-button">></div>
<div class="current-month"><%= year %> <%= month %></div>
</div>
<table class="clndr-grid">
<thead class="days-of-the-week">
<tr>
<% _.each(daysOfTheWeek, function(day) { %>
<th class="header-day"><%= day %></th>
<% }); %>
</tr>
</thead>
<tbody class="days">
<% _.each(days, function(day,index) { %>
<% if((index+1)%7 == 1) { %>
<tr>
<% } %>
<td class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span>
<% if(day.events.length && day.events[0].price ){ %>
<span class="dya-price">¥<%= day.events[0].price %> </span>
<% } %>
</td>
<% if((index+1)%7 == 0) { %>
</tr>
<% } %>
<% }); %>
</tbody>
</table>
</script>
</div>
</code></pre>
<pre>
<code class="language-javascript">
$('.my-clndr').clndr({
template: $('#my-clndr-template').html(),
events: events,
forceSixRows: true
});
</code>
</pre>
<div class="multi-clndr" id="my-multi-clndr">
<script type="text/template" id="template-calendar-months">
<% _.each(months, function(cal) { %>
<div class="col s4 ">
<div class="card-panel no-padding">
<div class="clndr-controls">
<div class="current-month"><b><%= cal.month.year() %></b> <%= cal.month.format('MMMM') %></div>
</div>
<table class="clndr-grid">
<thead class="days-of-the-week">
<tr>
<% _.each(daysOfTheWeek, function(day) { %>
<th class="header-day"><%= day %></th>
<% }); %>
</tr>
</thead>
<tbody class="days">
<% _.each(cal.days, function(day,index) { %>
<% if((index+1)%7 == 1) { %>
<tr>
<% } %>
<td class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span>
<% if(day.events.length && day.events[0].price ){ %>
<span class="day-price">¥<%= day.events[0].price %> </span>
<% } %>
</td>
<% if((index+1)%7 == 0) { %>
</tr>
<% } %>
<% }); %>
</div>
</tbody>
</table>
</div>
</div>
<% }); %>
</script>
</div>
<pre><code class="language-html">
<div class="multi-clndr row" id="my-multi-clndr">
<script type="text/template" id="template-calendar-months">
<% _.each(months, function(cal) { %>
<div class="col s4">
<div class="clndr-controls">
<div class="current-month"><b><%= cal.month.year() %></b> <%= cal.month.format('MMMM') %></div>
</div>
<table class="clndr-grid">
<thead class="days-of-the-week">
<tr>
<% _.each(daysOfTheWeek, function(day) { %>
<th class="header-day"><%= day %></th>
<% }); %>
</tr>
</thead>
<tbody class="days">
<% _.each(cal.days, function(day,index) { %>
<% if((index+1)%7 == 1) { %>
<tr>
<% } %>
<td class="<%= day.classes %>" id="<%= day.id %>"><span class="day-number"><%= day.day %></span>
<% if(day.events.length && day.events[0].price ){ %>
<span class="dya-price">¥<%= day.events[0].price %> </span>
<% } %>
</td>
<% if((index+1)%7 == 0) { %>
</tr>
<% } %>
<% }); %>
</div>
</tbody>
</table>
</div>
<% }); %>
</script>
</div>
</code></pre>
<pre>
<code class="language-javascript">
$('#my-multi-clndr').clndr({
template: $('#template-calendar-months').html(),
events: events,
forceSixRows: true,
lengthOfTime: {
months: 3,
interval: 1
},
constraints: {
startDate: currentMonth + '-' + '5',
endDate: next2Month + '-' + '20'
},
clickEvents: {
click: function(target) {
dayClick(target,event);
}
}
});
function dayClick(target, event) {
var elem = $(target.element);
if (!elem.hasClass('adjacent-month') && !elem.hasClass('inactive')) {
//如果shift键按下
if (event && event.shiftKey) {
var days = elem.closest('.clndr').find('td:not(.adjacent-month)','td:not(.inactive)');
console.log(days);
var selectedDays = days.filter('.selected');
if (selectedDays.length) {
var dayFirstSelected = selectedDays.first();
days.removeClass('selected');
//当前只有一个日期被选中
if (selectedDays.length == 1) {
var curIndex = days.index(elem);
var firstIndex = days.index(dayFirstSelected);
var daysRegion = curIndex > firstIndex ? days.slice(firstIndex, curIndex + 1) : days.slice(curIndex, firstIndex + 1);
daysRegion.addClass('selected');
} else {
var curIndex = days.index(elem);
var dayLastSelected = selectedDays.last();
var firstIndex = days.index(dayFirstSelected);
var lastIndex = days.index(dayLastSelected);
if (curIndex < firstIndex) {
days.slice(curIndex, lastIndex + 1).addClass('selected');
} else {
days.slice(firstIndex, curIndex + 1).addClass('selected');
}
}
} else {
elem.toggleClass('selected');
}
} else {
elem.toggleClass('selected');
}
}
}
</code>
</pre>
</div>
</div>
</div>