1.0.6 • Published 3 years ago
zy-date-to-calendar v1.0.6
参数详情
参数值 | 是否必填 | 参数类型 | 举例 |
---|---|---|---|
el | 必填 | Dom节点 | document.getElementById('#content')、this.$refs'content' |
options.date | 必填 | String、Array | '2021-6'、 '2021-5-1', '2021-6-12' |
options.backgroundDict | 非必填 | Object | {'1' : 'red', '2': 'yellow', .... , '11': 'blue', '12': 'green'} |
options.thColor | 非必填 | String | '#000' |
options.thBackground | 非必填 | String | '#000' |
options.emptyThBackground | 非必填 | String | '#000' |
options.tdWidth | 非必填 | Number、String | 120 、 '120' |
options.tdHeight | 非必填 | Number、String | 40 、 '40' |
options.isShowAstro | 非必填 | Boolean | true |
options.isShowChinese | 非必填 | Boolean | true |
用法如下
执行命令:npm i zy-date-to-calendar
引入方法:import { toCalendar } from "zy-date-to-calendar"
html部分
<!DOCTYPE html>
<html>
<head>
<mate charest="utf-8" />
<title>demo</title>
</head>
<body>
<div id="content"></div>
</body>
</html>
javascript部分
toCalendar(document.getElementById('#content'),{
date:'2021-6',//日期范围:两个日期数组,一个日期字符串
backgroundDict:null,//12个月份的td背景颜色
thColor:'',//表头的文字颜色
thBackground:'',//表头的背景颜色
emptyThBackground:'',//空td的背景色
tdWidth:130,//th,td的宽度
tdHeight:0,//th,td的高度
isShowAstro:false,//是否显示星座
isShowChinese:true,//是否显示农历信息
})