-
Notifications
You must be signed in to change notification settings - Fork 2
/
demo.html
32 lines (32 loc) · 1.24 KB
/
demo.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
<!--
- Calendar-js-demo - https://github.com/jinliming2/Calendar-js
- Created by Liming on 2016/8/1.
-->
<!DOCTYPE html>
<html lang="zh-CN">
<head>
<meta charset="UTF-8"/>
<meta name="renderer" content="webkit"/>
<meta name="viewport" content="width=device-width,initial-scale=1"/>
<meta name="author" content="金黎明,Liming Jin,[email protected],TianJin China"/>
<title>Demo for Calendar-js</title>
<script type="module" src="./src/Calendar.js"></script>
</head>
<body>
<demo-calendar id="calendar"></demo-calendar>
<div id="information"></div>
<script defer>
const [calendar, information] = [document.getElementById('calendar'), document.getElementById('information')];
const update = () => {
const info = calendar.information;
information.innerHTML = `
<h1>${info.solar.year}年${info.solar.month}月${info.solar.date}日 ${info.solar.week} ${info.solar.zodiac}年</h1>
<h2>${info.lunar.yearName}${info.lunar.zodiac}年 ${info.lunar.monthName}月 ${info.lunar.dayName}日</h2>
<h3>农历 ${info.lunar.zodiac}年${info.lunar.month}${info.lunar.date}${info.lunar.term ? " " + info.lunar.term : ""}</h3>
`;
};
calendar.addEventListener('date-changed', update);
calendar.addEventListener('loaded', update);
</script>
</body>
</html>