├── .github └── workflows │ └── npm-publish.yml ├── .gitignore ├── README.md ├── babel.config.js ├── dist ├── calendar.common.js ├── calendar.common.js.map ├── calendar.css ├── calendar.umd.js ├── calendar.umd.js.map ├── calendar.umd.min.js ├── calendar.umd.min.js.map └── demo.html ├── example ├── demo1.html ├── demo2.html ├── demo3.html ├── demo4.html ├── demo5.html ├── demo6.html ├── demo7.html ├── index.html └── lib │ ├── style.css │ └── vue.min.js ├── package-lock.json ├── package.json ├── public ├── favicon.ico └── index.html └── src ├── App.vue ├── assets ├── calendar.js └── styles.scss ├── components ├── index.vue ├── item.vue ├── main.js └── title-bar.vue └── main.js /.github/workflows/npm-publish.yml: -------------------------------------------------------------------------------- 1 | name: NPM Publish 2 | on: 3 | push: 4 | branches: 5 | - master 6 | jobs: 7 | publish: 8 | runs-on: ubuntu-latest 9 | steps: 10 | - uses: actions/checkout@v1 11 | - uses: actions/setup-node@v1 12 | with: 13 | node-version: 10 14 | - run: npm install 15 | - run: npm run package 16 | - uses: JS-DevTools/npm-publish@v1 17 | with: 18 | token: ${{ secrets.NPM_AUTH_TOKEN }} -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | 4 | 5 | # local env files 6 | .env.local 7 | .env.*.local 8 | 9 | # Log files 10 | npm-debug.log* 11 | yarn-debug.log* 12 | yarn-error.log* 13 | pnpm-debug.log* 14 | 15 | # Editor directories and files 16 | .idea 17 | .vscode 18 | *.suo 19 | *.ntvs* 20 | *.njsproj 21 | *.sln 22 | *.sw? 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Calendar 日历 2 | 3 | ![NPM Publish](https://github.com/wangdaodao/vue-lunar-calendar-pro/actions/workflows/npm-publish.yml/badge.svg) ![NPM version](https://img.shields.io/npm/v/vue-lunar-calendar-pro.svg) ![GitHub stars](https://img.shields.io/github/stars/wangdaodao/vue-lunar-calendar-pro.svg) ![GitHub issues](https://img.shields.io/github/issues/wangdaodao/vue-lunar-calendar-pro.svg) ![GitHub forks](https://img.shields.io/github/forks/wangdaodao/vue-lunar-calendar-pro.svg) 4 | 5 | * 😊 基于 vue 2.0 开发的轻量,高性能日历组件; 6 | * 😘 支持农历,节气,假日显示; 7 | * 😍 原生 js 开发,无第三方库; 8 | * 😂 支持现代浏览器(IE >= 9); 9 | * 👍 感谢 [calendar.js](https://github.com/jjonline/calendar.js) 10 | 11 | ## 安装 12 | 13 | ### NPM 14 | 15 | ```bash 16 | npm i vue-lunar-calendar-pro --save 17 | ``` 18 | 19 | ### CDN 20 | 21 | 目前可以通过 [unpkg.com/vue-lunar-calendar-pro](https://unpkg.com/vue-lunar-calendar-pro) 或者 [www.jsdelivr.com/package/npm/vue-lunar-calendar-pro](https://www.jsdelivr.com/package/npm/vue-lunar-calendar-pro) 获取到最新版本的资源,在页面上引入 js 和 css 文件即可开始使用。 22 | 23 | 🚩 建议使用 CDN 引入组件的用户在链接地址上锁定版本,以免将来组件升级时受到非兼容性更新的影响。🚩 24 | 25 | ```html 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | ``` 37 | 38 | ## 使用 39 | 40 | ### 全局使用 41 | 42 | ```js 43 | // main.js 44 | import Vue from 'vue' 45 | import App from './App.vue' 46 | // ... 47 | import 'vue-lunar-calendar-pro/dist/calendar.css'; 48 | import Calandar from 'vue-lunar-calendar-pro' 49 | Vue.use(Calandar) 50 | 51 | // ... 52 | 53 | new Vue({ 54 | el: '#app', 55 | render: h => h(App) 56 | }) 57 | ``` 58 | 59 | ```html 60 | 61 | 66 | 67 | 72 | ``` 73 | 74 | ### 本地注册 75 | ```html 76 | 77 | 82 | 83 | 91 | ``` 92 | 93 | ## 例子 94 | 95 | ### 基本单选 96 | 97 | 🔸 设置 `default-date` 来指定当前显示的月份。如果 `default-date` 未指定,则显示当月。 98 | 99 | 基本单选: [demo1](http://demo.const.team/calendar/demo1.html) 100 | 101 | ```html 102 | 108 | 109 | 119 | ``` 120 | 121 | ### 基本多选 122 | 123 | 🔸 设置 `multiple` 开启日期多选。 124 | 125 | 基本多选: [demo2](http://demo.const.team/calendar/demo2.html) 126 | 127 | ```html 128 | 133 | 134 | 143 | ``` 144 | 145 | ### 设置周起始日 146 | 147 | 🔸 设置 `first-day-of-week` 来指定周起始日。如果 `first-day-of-week` 未指定则按照周日为起始日。 148 | 149 | 设置周起始日: [demo3](http://demo.const.team/calendar/demo3.html) 150 | 151 | ```html 152 | 157 | 158 | 167 | ``` 168 | 169 | ### 高亮日期 170 | 171 | 🔸 设置 `highlighter-date` 高亮日期。 172 | 173 | 高亮日期: [demo4](http://demo.const.team/calendar/demo4.html) 174 | 175 | ```html 176 | 182 | 183 | 193 | ``` 194 | 195 | ### 某些日期不可选 196 | 197 | 🔸 设置 `disabled-date` 来指定当哪些日期不可选。 198 | 199 | 某些日期不可选: [demo5](http://demo.const.team/calendar/demo5.html) 200 | 201 | ```html 202 | 208 | 209 | 219 | ``` 220 | 221 | ### 设置日期区间 222 | 223 | 🔸 设置 `max-date` 和 `min-date` 来设置日期区间。 224 | 225 | 设置日期区间: [demo6](http://demo.const.team/calendar/demo6.html) 226 | 227 | ```html 228 | 235 | 236 | 246 | ``` 247 | 248 | ### 自定义Render 249 | 250 | 🔸 内置 `render` 方法,参数为`year, month`,配合其他组件使用。另外,通过设置名为 `dateCell` 的 `scoped-slot` 来自定义日历单元格中显示的内容。在 `scoped-slot` 可以获取到 `date`(当前单元格的日期对象),详情解释参考下方的 `API` 文档。 251 | 252 | 自定义Render: [demo7](http://demo.const.team/calendar/demo7.html) 253 | 254 | ```html 255 | 294 | 311 | ``` 312 | 313 | ## 属性 314 | | 参数 | 说明 | 类型 | 可选值 | 默认值 | 315 | |-----------------|-------------- |---------- |------------ |-------- | 316 | | default-date|默认渲染日期|Date,String|能被new Date()解析的|new Date()| 317 | | select-date | 绑定值 | Array | — | — | 318 | | highlighter-date | 高亮日期 | Array | — | — | 319 | | disabled-date | 不可选日期 | Array | — | — | 320 | | max-date | 最大可选日期 | Date,String | 能被new Date()解析的 | — | 321 | | min-date | 最小可选日期 | Date,String | 能被new Date()解析的 | — | 322 | | show-lunar | 是否渲染农历 | Boolean | — | true | 323 | | show-festival | 是否渲染节日 | Boolean | — | true | 324 | | show-term | 是否渲染节气 | Boolean | — | true | 325 | | show-week | 是否高亮周末 | Boolean | — | true | 326 | | show-title | 是否显示头部标题栏(年月日/按钮) | Boolean | — | true | 327 | | week-count | 每月显示的行的数量 | Number | — | 6 | 328 | | first-day-of-week | 周起始日 | Number | 1 到 7 | 7 | 329 | | multiple | 是否多选 | Boolean | — | false | 330 | 331 | ## 事件 332 | 333 | | 事件名 | 说明 | 参数 | 334 | |---|---|---| 335 | | year-change | 当前渲染的年份变化时会触发该事件 | year,month | 336 | | month-change | 当前渲染的月份变化时会触发该事件 | year,month | 337 | | date-click | 点击某个日期格子时会触发该事件 | date | 338 | 339 | ## 插槽 340 | | 参数 | 说明 | 341 | |---|---| 342 | | dateCell | 当前单元格的日期对象 | 343 | 344 | ## Date 对象 345 | 346 | | 字段 | 说明 | 347 | |---|---| 348 | | date | Date对象 | 349 | | year | 年 | 350 | | month | 月 | 351 | | day | 日 | 352 | | weekDay | 周几(0-6) | 353 | | lunar | 农历日 | 354 | | lunarMonth | 农历日 | 355 | | festival | 节日 | 356 | | lunarFestival | 农历节日 | 357 | | term | 节气 | 358 | | astro | 星座 | 359 | | animal | 属相 | 360 | | gzDay | 干支天 | 361 | | gzMonth | 干支月 | 362 | | gzYear | 干支年 | 363 | | isToday | 是否为今天 | 364 | | isSelect | 是否选中 | 365 | | isWeekend | 是否为周末 | 366 | | isOtherMonthDay | 是否属于当前渲染月份 | 367 | | renderYear | 当前渲染年份 | 368 | | renderMonth | 当前渲染月份 | 369 | | isDefaultDate | 是否是默认日期 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /dist/calendar.css: -------------------------------------------------------------------------------- 1 | .calendar-pro{background-color:#fff;width:100%;height:100%}.calendar-pro__title{*zoom:1;margin-bottom:20px}.calendar-pro__title:after,.calendar-pro__title:before{content:"";display:table;height:0}.calendar-pro__title:after{clear:both}.calendar-pro__title-info{float:left;display:inline;color:#17233d;font-size:18px}.calendar-pro__tool{float:right;display:inline;position:relative;display:inline-block;vertical-align:middle}.calendar-pro__tool button{padding:5px 15px;border:1px solid #dcdee2;color:#515a6e;background-color:transparent;position:relative}.calendar-pro__tool button:hover{color:#57a3f3;background-color:#fff;border-color:#57a3f3;cursor:pointer;z-index:2}.calendar-pro__tool button:first-child{margin-left:0}.calendar-pro__tool button+button{margin-left:-1px}.calendar-pro.showWeek .weekend{background-color:#efefef}.calendar-pro__body table{border-collapse:collapse}.calendar-pro__body table th{padding:10px 0;font-weight:400}.calendar-pro__body table td{position:relative;border:1px solid #d2d2d2;width:300px;cursor:pointer}.calendar-pro__body table td:hover .day-box{background-color:#e8f4ff}.calendar-pro__body table td .day-box{position:relative;height:68px;padding:10px;font-size:14px}.calendar-pro__body table td .day-box.highlighter{background-color:#f0f9e8}.calendar-pro__body table td .day-box.highlighter .info-date{color:#66bf16}.calendar-pro__body table td .day-box.select{width:auto;background-color:#e8f4ff}.calendar-pro__body table td .day-box.select .info-date{color:#1890ff}.calendar-pro__body table td .day-box.disabled{cursor:not-allowed;background-color:#e5e5e5;color:#999}.calendar-pro__body table td .day-box.other-month-day{opacity:.6}.calendar-pro__body table td .day-box.today{outline:2px solid #1890ff;z-index:2}.calendar-pro__body table td .info-date{font-size:18px;font-weight:bolder}.calendar-pro__body table td .info-festival{margin-top:3px;text-align:center}.calendar-pro__body table td .info-lunar{position:absolute;bottom:10px;right:10px}.calendar-pro__body table td .info-term{position:absolute;bottom:10px;left:10px} -------------------------------------------------------------------------------- /dist/calendar.umd.min.js: -------------------------------------------------------------------------------- 1 | (function(e,t){"object"===typeof exports&&"object"===typeof module?module.exports=t():"function"===typeof define&&define.amd?define([],t):"object"===typeof exports?exports["calendar"]=t():e["calendar"]=t()})("undefined"!==typeof self?self:this,(function(){return function(e){var t={};function n(r){if(t[r])return t[r].exports;var c=t[r]={i:r,l:!1,exports:{}};return e[r].call(c.exports,c,c.exports,n),c.l=!0,c.exports}return n.m=e,n.c=t,n.d=function(e,t,r){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:r})},n.r=function(e){"undefined"!==typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"===typeof e&&e&&e.__esModule)return e;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var c in e)n.d(r,c,function(t){return e[t]}.bind(null,c));return r},n.n=function(e){var t=e&&e.__esModule?function(){return e["default"]}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="",n(n.s="fb15")}({"00ee":function(e,t,n){var r=n("b622"),c=r("toStringTag"),f={};f[c]="z",e.exports="[object z]"===String(f)},"06cf":function(e,t,n){var r=n("83ab"),c=n("d1e7"),f=n("5c6c"),a=n("fc6a"),o=n("c04e"),i=n("5135"),b=n("0cfb"),u=Object.getOwnPropertyDescriptor;t.f=r?u:function(e,t){if(e=a(e),t=o(t,!0),b)try{return u(e,t)}catch(n){}if(i(e,t))return f(!c.f.call(e,t),e[t])}},"0cfb":function(e,t,n){var r=n("83ab"),c=n("d039"),f=n("cc12");e.exports=!r&&!c((function(){return 7!=Object.defineProperty(f("div"),"a",{get:function(){return 7}}).a}))},"1be4":function(e,t,n){var r=n("d066");e.exports=r("document","documentElement")},"1d80":function(e,t){e.exports=function(e){if(void 0==e)throw TypeError("Can't call method on "+e);return e}},"1dde":function(e,t,n){var r=n("d039"),c=n("b622"),f=n("2d00"),a=c("species");e.exports=function(e){return f>=51||!r((function(){var t=[],n=t.constructor={};return n[a]=function(){return{foo:1}},1!==t[e](Boolean).foo}))}},"23cb":function(e,t,n){var r=n("a691"),c=Math.max,f=Math.min;e.exports=function(e,t){var n=r(e);return n<0?c(n+t,0):f(n,t)}},"23e7":function(e,t,n){var r=n("da84"),c=n("06cf").f,f=n("9112"),a=n("6eeb"),o=n("ce4e"),i=n("e893"),b=n("94ca");e.exports=function(e,t){var n,u,s,l,d,h,p=e.target,v=e.global,g=e.stat;if(u=v?r:g?r[p]||o(p,{}):(r[p]||{}).prototype,u)for(s in t){if(d=t[s],e.noTargetGet?(h=c(u,s),l=h&&h.value):l=u[s],n=b(v?s:p+(g?".":"#")+s,e.forced),!n&&void 0!==l){if(typeof d===typeof l)continue;i(d,l)}(e.sham||l&&l.sham)&&f(d,"sham",!0),a(u,s,d,e)}}},"241c":function(e,t,n){var r=n("ca84"),c=n("7839"),f=c.concat("length","prototype");t.f=Object.getOwnPropertyNames||function(e){return r(e,f)}},"25f0":function(e,t,n){"use strict";var r=n("6eeb"),c=n("825a"),f=n("d039"),a=n("ad6d"),o="toString",i=RegExp.prototype,b=i[o],u=f((function(){return"/a/b"!=b.call({source:"a",flags:"b"})})),s=b.name!=o;(u||s)&&r(RegExp.prototype,o,(function(){var e=c(this),t=String(e.source),n=e.flags,r=String(void 0===n&&e instanceof RegExp&&!("flags"in i)?a.call(e):n);return"/"+t+"/"+r}),{unsafe:!0})},"2d00":function(e,t,n){var r,c,f=n("da84"),a=n("342f"),o=f.process,i=o&&o.versions,b=i&&i.v8;b?(r=b.split("."),c=r[0]+r[1]):a&&(r=a.match(/Edge\/(\d+)/),(!r||r[1]>=74)&&(r=a.match(/Chrome\/(\d+)/),r&&(c=r[1]))),e.exports=c&&+c},"2fc4":function(e,t,n){},"342f":function(e,t,n){var r=n("d066");e.exports=r("navigator","userAgent")||""},"37e8":function(e,t,n){var r=n("83ab"),c=n("9bf2"),f=n("825a"),a=n("df75");e.exports=r?Object.defineProperties:function(e,t){f(e);var n,r=a(t),o=r.length,i=0;while(o>i)c.f(e,n=r[i++],t[n]);return e}},"3bbe":function(e,t,n){var r=n("861d");e.exports=function(e){if(!r(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");return e}},"428f":function(e,t,n){var r=n("da84");e.exports=r},"44ad":function(e,t,n){var r=n("d039"),c=n("c6b6"),f="".split;e.exports=r((function(){return!Object("z").propertyIsEnumerable(0)}))?function(e){return"String"==c(e)?f.call(e,""):Object(e)}:Object},4930:function(e,t,n){var r=n("d039");e.exports=!!Object.getOwnPropertySymbols&&!r((function(){return!String(Symbol())}))},"4d64":function(e,t,n){var r=n("fc6a"),c=n("50c4"),f=n("23cb"),a=function(e){return function(t,n,a){var o,i=r(t),b=c(i.length),u=f(a,b);if(e&&n!=n){while(b>u)if(o=i[u++],o!=o)return!0}else for(;b>u;u++)if((e||u in i)&&i[u]===n)return e||u||0;return!e&&-1}};e.exports={includes:a(!0),indexOf:a(!1)}},"50c4":function(e,t,n){var r=n("a691"),c=Math.min;e.exports=function(e){return e>0?c(r(e),9007199254740991):0}},5135:function(e,t){var n={}.hasOwnProperty;e.exports=function(e,t){return n.call(e,t)}},5692:function(e,t,n){var r=n("c430"),c=n("c6cd");(e.exports=function(e,t){return c[e]||(c[e]=void 0!==t?t:{})})("versions",[]).push({version:"3.8.1",mode:r?"pure":"global",copyright:"© 2020 Denis Pushkarev (zloirock.ru)"})},"56ef":function(e,t,n){var r=n("d066"),c=n("241c"),f=n("7418"),a=n("825a");e.exports=r("Reflect","ownKeys")||function(e){var t=c.f(a(e)),n=f.f;return n?t.concat(n(e)):t}},5899:function(e,t){e.exports="\t\n\v\f\r                 \u2028\u2029\ufeff"},"58a8":function(e,t,n){var r=n("1d80"),c=n("5899"),f="["+c+"]",a=RegExp("^"+f+f+"*"),o=RegExp(f+f+"*$"),i=function(e){return function(t){var n=String(r(t));return 1&e&&(n=n.replace(a,"")),2&e&&(n=n.replace(o,"")),n}};e.exports={start:i(1),end:i(2),trim:i(3)}},"5c6c":function(e,t){e.exports=function(e,t){return{enumerable:!(1&e),configurable:!(2&e),writable:!(4&e),value:t}}},"65f0":function(e,t,n){var r=n("861d"),c=n("e8b5"),f=n("b622"),a=f("species");e.exports=function(e,t){var n;return c(e)&&(n=e.constructor,"function"!=typeof n||n!==Array&&!c(n.prototype)?r(n)&&(n=n[a],null===n&&(n=void 0)):n=void 0),new(void 0===n?Array:n)(0===t?0:t)}},"69f3":function(e,t,n){var r,c,f,a=n("7f9a"),o=n("da84"),i=n("861d"),b=n("9112"),u=n("5135"),s=n("c6cd"),l=n("f772"),d=n("d012"),h=o.WeakMap,p=function(e){return f(e)?c(e):r(e,{})},v=function(e){return function(t){var n;if(!i(t)||(n=c(t)).type!==e)throw TypeError("Incompatible receiver, "+e+" required");return n}};if(a){var g=s.state||(s.state=new h),y=g.get,m=g.has,D=g.set;r=function(e,t){return t.facade=e,D.call(g,e,t),t},c=function(e){return y.call(g,e)||{}},f=function(e){return m.call(g,e)}}else{var x=l("state");d[x]=!0,r=function(e,t){return t.facade=e,b(e,x,t),t},c=function(e){return u(e,x)?e[x]:{}},f=function(e){return u(e,x)}}e.exports={set:r,get:c,has:f,enforce:p,getterFor:v}},"6eeb":function(e,t,n){var r=n("da84"),c=n("9112"),f=n("5135"),a=n("ce4e"),o=n("8925"),i=n("69f3"),b=i.get,u=i.enforce,s=String(String).split("String");(e.exports=function(e,t,n,o){var i,b=!!o&&!!o.unsafe,l=!!o&&!!o.enumerable,d=!!o&&!!o.noTargetGet;"function"==typeof n&&("string"!=typeof t||f(n,"name")||c(n,"name",t),i=u(n),i.source||(i.source=s.join("string"==typeof t?t:""))),e!==r?(b?!d&&e[t]&&(l=!0):delete e[t],l?e[t]=n:c(e,t,n)):l?e[t]=n:a(t,n)})(Function.prototype,"toString",(function(){return"function"==typeof this&&b(this).source||o(this)}))},7156:function(e,t,n){var r=n("861d"),c=n("d2bb");e.exports=function(e,t,n){var f,a;return c&&"function"==typeof(f=t.constructor)&&f!==n&&r(a=f.prototype)&&a!==n.prototype&&c(e,a),e}},7418:function(e,t){t.f=Object.getOwnPropertySymbols},7839:function(e,t){e.exports=["constructor","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","toLocaleString","toString","valueOf"]},"7b0b":function(e,t,n){var r=n("1d80");e.exports=function(e){return Object(r(e))}},"7c73":function(e,t,n){var r,c=n("825a"),f=n("37e8"),a=n("7839"),o=n("d012"),i=n("1be4"),b=n("cc12"),u=n("f772"),s=">",l="<",d="prototype",h="script",p=u("IE_PROTO"),v=function(){},g=function(e){return l+h+s+e+l+"/"+h+s},y=function(e){e.write(g("")),e.close();var t=e.parentWindow.Object;return e=null,t},m=function(){var e,t=b("iframe"),n="java"+h+":";return t.style.display="none",i.appendChild(t),t.src=String(n),e=t.contentWindow.document,e.open(),e.write(g("document.F=Object")),e.close(),e.F},D=function(){try{r=document.domain&&new ActiveXObject("htmlfile")}catch(t){}D=r?y(r):m();var e=a.length;while(e--)delete D[d][a[e]];return D()};o[p]=!0,e.exports=Object.create||function(e,t){var n;return null!==e?(v[d]=c(e),n=new v,v[d]=null,n[p]=e):n=D(),void 0===t?n:f(n,t)}},"7f9a":function(e,t,n){var r=n("da84"),c=n("8925"),f=r.WeakMap;e.exports="function"===typeof f&&/native code/.test(c(f))},"825a":function(e,t,n){var r=n("861d");e.exports=function(e){if(!r(e))throw TypeError(String(e)+" is not an object");return e}},"83ab":function(e,t,n){var r=n("d039");e.exports=!r((function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}))},8418:function(e,t,n){"use strict";var r=n("c04e"),c=n("9bf2"),f=n("5c6c");e.exports=function(e,t,n){var a=r(t);a in e?c.f(e,a,f(0,n)):e[a]=n}},"861d":function(e,t){e.exports=function(e){return"object"===typeof e?null!==e:"function"===typeof e}},8875:function(e,t,n){var r,c,f;(function(n,a){c=[],r=a,f="function"===typeof r?r.apply(t,c):r,void 0===f||(e.exports=f)})("undefined"!==typeof self&&self,(function(){function e(){var t=Object.getOwnPropertyDescriptor(document,"currentScript");if(!t&&"currentScript"in document&&document.currentScript)return document.currentScript;if(t&&t.get!==e&&document.currentScript)return document.currentScript;try{throw new Error}catch(d){var n,r,c,f=/.*at [^(]*\((.*):(.+):(.+)\)$/gi,a=/@([^@]*):(\d+):(\d+)\s*$/gi,o=f.exec(d.stack)||a.exec(d.stack),i=o&&o[1]||!1,b=o&&o[2]||!1,u=document.location.href.replace(document.location.hash,""),s=document.getElementsByTagName("script");i===u&&(n=document.documentElement.outerHTML,r=new RegExp("(?:[^\\n]+?\\n){0,"+(b-2)+"}[^<]* 4 | 5 | 6 | 7 | 8 | 11 | -------------------------------------------------------------------------------- /example/demo1.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 基本单选 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |

默认日期:{{defaultDate}}

15 |

选中日期:{{date}}

16 |
17 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/demo2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 基本多选 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |

选中日期:{{date}}

15 |
16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /example/demo3.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 设置周起始日 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |

选中日期:{{date}}

15 |
16 | 24 | 25 | 26 | -------------------------------------------------------------------------------- /example/demo4.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 高亮日期 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |

选中日期:{{date}}

15 |

高亮日期:{{highlighter}}

16 |
17 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/demo5.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 某些日期不可选 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |

选中日期:{{date}}

15 |

不可选日期:{{disableddate}}

16 |
17 | 26 | 27 | 28 | -------------------------------------------------------------------------------- /example/demo6.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 设置日期区间 6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 |

选中日期:{{date}}

15 |

不可选日期:{{disableddate}}

16 |

区间:2019-05-01至2019-12-31

17 |
18 | 27 | 28 | 29 | -------------------------------------------------------------------------------- /example/demo7.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Render方法 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 23 | 24 | 25 | 26 | 49 | 50 |
51 | 67 | 78 | 79 | 80 | -------------------------------------------------------------------------------- /example/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | Calendar 日历 6 | 7 | 8 |
9 | 18 |
19 | 20 | 21 | -------------------------------------------------------------------------------- /example/lib/style.css: -------------------------------------------------------------------------------- 1 | .demonstration{ 2 | font-size: 16px; 3 | color:#8492a6; 4 | margin: 20px 0 0; 5 | } -------------------------------------------------------------------------------- /example/lib/vue.min.js: -------------------------------------------------------------------------------- 1 | /*! 2 | * Vue.js v2.5.13 3 | * (c) 2014-2017 Evan You 4 | * Released under the MIT License. 5 | */ 6 | !function(t,e){"object"==typeof exports&&"undefined"!=typeof module?module.exports=e():"function"==typeof define&&define.amd?define(e):t.Vue=e()}(this,function(){"use strict";function t(t){return void 0===t||null===t}function e(t){return void 0!==t&&null!==t}function n(t){return!0===t}function r(t){return"string"==typeof t||"number"==typeof t||"symbol"==typeof t||"boolean"==typeof t}function i(t){return null!==t&&"object"==typeof t}function o(t){return"[object Object]"===Nn.call(t)}function a(t){var e=parseFloat(String(t));return e>=0&&Math.floor(e)===e&&isFinite(t)}function s(t){return null==t?"":"object"==typeof t?JSON.stringify(t,null,2):String(t)}function c(t){var e=parseFloat(t);return isNaN(e)?t:e}function u(t,e){for(var n=Object.create(null),r=t.split(","),i=0;i-1)return t.splice(n,1)}}function f(t,e){return Mn.call(t,e)}function p(t){var e=Object.create(null);return function(n){return e[n]||(e[n]=t(n))}}function d(t,e){function n(n){var r=arguments.length;return r?r>1?t.apply(e,arguments):t.call(e,n):t.call(e)}return n._length=t.length,n}function v(t,e){e=e||0;for(var n=t.length-e,r=new Array(n);n--;)r[n]=t[n+e];return r}function h(t,e){for(var n in e)t[n]=e[n];return t}function m(t){for(var e={},n=0;n0&&(tt((s=et(s,(o||"")+"_"+a))[0])&&tt(u)&&(l[c]=x(u.text+s[0].text),s.shift()),l.push.apply(l,s)):r(s)?tt(u)?l[c]=x(u.text+s):""!==s&&l.push(x(s)):tt(s)&&tt(u)?l[c]=x(u.text+s.text):(n(i._isVList)&&e(s.tag)&&t(s.key)&&e(o)&&(s.key="__vlist"+o+"_"+a+"__"),l.push(s)));return l}function nt(t,e){return(t.__esModule||fr&&"Module"===t[Symbol.toStringTag])&&(t=t.default),i(t)?e.extend(t):t}function rt(t){return t.isComment&&t.asyncFactory}function it(t){if(Array.isArray(t))for(var n=0;n=0||n.indexOf(t[i])<0)&&r.push(t[i]);return r}return t}}(n[o],r[o],i[o]));return e}(t);r&&h(t.extendOptions,r),(e=t.options=F(n,t.extendOptions)).name&&(e.components[e.name]=t)}}return e}function Rt(t){this._init(t)}function Ht(t){t.cid=0;var e=1;t.extend=function(t){t=t||{};var n=this,r=n.cid,i=t._Ctor||(t._Ctor={});if(i[r])return i[r];var o=t.name||n.options.name,a=function(t){this._init(t)};return a.prototype=Object.create(n.prototype),a.prototype.constructor=a,a.cid=e++,a.options=F(n.options,t),a.super=n,a.options.props&&function(t){var e=t.options.props;for(var n in e)mt(t.prototype,"_props",n)}(a),a.options.computed&&function(t){var e=t.options.computed;for(var n in e)gt(t.prototype,n,e[n])}(a),a.extend=n.extend,a.mixin=n.mixin,a.use=n.use,zn.forEach(function(t){a[t]=n[t]}),o&&(a.options.components[o]=a),a.superOptions=n.options,a.extendOptions=t,a.sealedOptions=h({},a.options),i[r]=a,a}}function Bt(t){return t&&(t.Ctor.options.name||t.tag)}function Ut(t,e){return Array.isArray(t)?t.indexOf(e)>-1:"string"==typeof t?t.split(",").indexOf(e)>-1:!!function(t){return"[object RegExp]"===Nn.call(t)}(t)&&t.test(e)}function Vt(t,e){var n=t.cache,r=t.keys,i=t._vnode;for(var o in n){var a=n[o];if(a){var s=Bt(a.componentOptions);s&&!e(s)&&zt(n,o,r,i)}}}function zt(t,e,n,r){var i=t[e];!i||r&&i.tag===r.tag||i.componentInstance.$destroy(),t[e]=null,l(n,e)}function Kt(t){for(var n=t.data,r=t,i=t;e(i.componentInstance);)(i=i.componentInstance._vnode)&&i.data&&(n=Jt(i.data,n));for(;e(r=r.parent);)r&&r.data&&(n=Jt(n,r.data));return function(t,n){if(e(t)||e(n))return qt(t,Wt(n));return""}(n.staticClass,n.class)}function Jt(t,n){return{staticClass:qt(t.staticClass,n.staticClass),class:e(t.class)?[t.class,n.class]:n.class}}function qt(t,e){return t?e?t+" "+e:t:e||""}function Wt(t){return Array.isArray(t)?function(t){for(var n,r="",i=0,o=t.length;i=0&&" "===(m=t.charAt(h));h--);m&&Ii.test(m)||(l=!0)}}else void 0===o?(v=i+1,o=t.slice(0,i).trim()):e();if(void 0===o?o=t.slice(0,i).trim():0!==v&&e(),a)for(i=0;i-1?{exp:t.slice(0,ii),key:'"'+t.slice(ii+1)+'"'}:{exp:t,key:null};ni=t,ii=oi=ai=0;for(;!_e();)be(ri=ge())?$e(ri):91===ri&&function(t){var e=1;oi=ii;for(;!_e();)if(t=ge(),be(t))$e(t);else if(91===t&&e++,93===t&&e--,0===e){ai=ii;break}}(ri);return{exp:t.slice(0,oi),key:t.slice(oi+1,ai)}}(t);return null===n.key?t+"="+e:"$set("+n.exp+", "+n.key+", "+e+")"}function ge(){return ni.charCodeAt(++ii)}function _e(){return ii>=ei}function be(t){return 34===t||39===t}function $e(t){for(var e=t;!_e()&&(t=ge())!==e;);}function Ce(t,e,n,r,i){e=function(t){return t._withTask||(t._withTask=function(){Er=!0;var e=t.apply(null,arguments);return Er=!1,e})}(e),n&&(e=function(t,e,n){var r=si;return function i(){null!==t.apply(null,arguments)&&we(e,i,n,r)}}(e,t,r)),si.addEventListener(t,e,or?{capture:r,passive:i}:r)}function we(t,e,n,r){(r||si).removeEventListener(t,e._withTask||e,n)}function xe(n,r){if(!t(n.data.on)||!t(r.data.on)){var i=r.data.on||{},o=n.data.on||{};si=r.elm,function(t){if(e(t[Li])){var n=Qn?"change":"input";t[n]=[].concat(t[Li],t[n]||[]),delete t[Li]}e(t[Mi])&&(t.change=[].concat(t[Mi],t.change||[]),delete t[Mi])}(i),X(i,o,Ce,we,r.context),si=void 0}}function ke(n,r){if(!t(n.data.domProps)||!t(r.data.domProps)){var i,o,a=r.elm,s=n.data.domProps||{},u=r.data.domProps||{};e(u.__ob__)&&(u=r.data.domProps=h({},u));for(i in s)t(u[i])&&(a[i]="");for(i in u){if(o=u[i],"textContent"===i||"innerHTML"===i){if(r.children&&(r.children.length=0),o===s[i])continue;1===a.childNodes.length&&a.removeChild(a.childNodes[0])}if("value"===i){a._value=o;var l=t(o)?"":String(o);(function(t,n){return!t.composing&&("OPTION"===t.tagName||function(t,e){var n=!0;try{n=document.activeElement!==t}catch(t){}return n&&t.value!==e}(t,n)||function(t,n){var r=t.value,i=t._vModifiers;if(e(i)){if(i.lazy)return!1;if(i.number)return c(r)!==c(n);if(i.trim)return r.trim()!==n.trim()}return r!==n}(t,n))})(a,l)&&(a.value=l)}else a[i]=o}}}function Ae(t){var e=Oe(t.style);return t.staticStyle?h(t.staticStyle,e):e}function Oe(t){return Array.isArray(t)?m(t):"string"==typeof t?Fi(t):t}function Se(n,r){var i=r.data,o=n.data;if(!(t(i.staticStyle)&&t(i.style)&&t(o.staticStyle)&&t(o.style))){var a,s,c=r.elm,u=o.staticStyle,l=o.normalizedStyle||o.style||{},f=u||l,p=Oe(r.data.style)||{};r.data.normalizedStyle=e(p.__ob__)?h({},p):p;var d=function(t,e){var n,r={};if(e)for(var i=t;i.componentInstance;)(i=i.componentInstance._vnode)&&i.data&&(n=Ae(i.data))&&h(r,n);(n=Ae(t.data))&&h(r,n);for(var o=t;o=o.parent;)o.data&&(n=Ae(o.data))&&h(r,n);return r}(r,!0);for(s in f)t(d[s])&&Bi(c,s,"");for(s in d)(a=d[s])!==f[s]&&Bi(c,s,null==a?"":a)}}function Te(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(/\s+/).forEach(function(e){return t.classList.add(e)}):t.classList.add(e);else{var n=" "+(t.getAttribute("class")||"")+" ";n.indexOf(" "+e+" ")<0&&t.setAttribute("class",(n+e).trim())}}function Ee(t,e){if(e&&(e=e.trim()))if(t.classList)e.indexOf(" ")>-1?e.split(/\s+/).forEach(function(e){return t.classList.remove(e)}):t.classList.remove(e),t.classList.length||t.removeAttribute("class");else{for(var n=" "+(t.getAttribute("class")||"")+" ",r=" "+e+" ";n.indexOf(r)>=0;)n=n.replace(r," ");(n=n.trim())?t.setAttribute("class",n):t.removeAttribute("class")}}function je(t){if(t){if("object"==typeof t){var e={};return!1!==t.css&&h(e,Ki(t.name||"v")),h(e,t),e}return"string"==typeof t?Ki(t):void 0}}function Ne(t){Qi(function(){Qi(t)})}function Ie(t,e){var n=t._transitionClasses||(t._transitionClasses=[]);n.indexOf(e)<0&&(n.push(e),Te(t,e))}function Le(t,e){t._transitionClasses&&l(t._transitionClasses,e),Ee(t,e)}function Me(t,e,n){var r=De(t,e),i=r.type,o=r.timeout,a=r.propCount;if(!i)return n();var s=i===qi?Zi:Yi,c=0,u=function(){t.removeEventListener(s,l),n()},l=function(e){e.target===t&&++c>=a&&u()};setTimeout(function(){c0&&(n=qi,l=a,f=o.length):e===Wi?u>0&&(n=Wi,l=u,f=c.length):f=(n=(l=Math.max(a,u))>0?a>u?qi:Wi:null)?n===qi?o.length:c.length:0;return{type:n,timeout:l,propCount:f,hasTransform:n===qi&&to.test(r[Gi+"Property"])}}function Pe(t,e){for(;t.length1}function Ve(t,e){!0!==e.data.show&&Re(e)}function ze(t,e,n){Ke(t,e,n),(Qn||er)&&setTimeout(function(){Ke(t,e,n)},0)}function Ke(t,e,n){var r=e.value,i=t.multiple;if(!i||Array.isArray(r)){for(var o,a,s=0,c=t.options.length;s-1,a.selected!==o&&(a.selected=o);else if(g(qe(a),r))return void(t.selectedIndex!==s&&(t.selectedIndex=s));i||(t.selectedIndex=-1)}}function Je(t,e){return e.every(function(e){return!g(e,t)})}function qe(t){return"_value"in t?t._value:t.value}function We(t){t.target.composing=!0}function Ge(t){t.target.composing&&(t.target.composing=!1,Ze(t.target,"input"))}function Ze(t,e){var n=document.createEvent("HTMLEvents");n.initEvent(e,!0,!0),t.dispatchEvent(n)}function Xe(t){return!t.componentInstance||t.data&&t.data.transition?t:Xe(t.componentInstance._vnode)}function Ye(t){var e=t&&t.componentOptions;return e&&e.Ctor.options.abstract?Ye(it(e.children)):t}function Qe(t){var e={},n=t.$options;for(var r in n.propsData)e[r]=t[r];var i=n._parentListeners;for(var o in i)e[Pn(o)]=i[o];return e}function tn(t,e){if(/\d-keep-alive$/.test(e.tag))return t("keep-alive",{props:e.componentOptions.propsData})}function en(t){t.elm._moveCb&&t.elm._moveCb(),t.elm._enterCb&&t.elm._enterCb()}function nn(t){t.data.newPos=t.elm.getBoundingClientRect()}function rn(t){var e=t.data.pos,n=t.data.newPos,r=e.left-n.left,i=e.top-n.top;if(r||i){t.data.moved=!0;var o=t.elm.style;o.transform=o.WebkitTransform="translate("+r+"px,"+i+"px)",o.transitionDuration="0s"}}function on(t,e){var n=e?zo:Vo;return t.replace(n,function(t){return Uo[t]})}function an(t,e,n){return{type:1,tag:t,attrsList:e,attrsMap:function(t){for(var e={},n=0,r=t.length;n=0&&a[i].lowerCasedTag!==s;i--);else i=0;if(i>=0){for(var c=a.length-1;c>=i;c--)e.end&&e.end(a[c].tag,n,r);a.length=i,o=i&&a[i-1].tag}else"br"===s?e.start&&e.start(t,[],!0,n,r):"p"===s&&(e.start&&e.start(t,[],!1,n,r),e.end&&e.end(t,n,r))}for(var i,o,a=[],s=e.expectHTML,c=e.isUnaryTag||Bn,u=e.canBeLeftOpenTag||Bn,l=0;t;){if(i=t,o&&Ho(o)){var f=0,p=o.toLowerCase(),d=Bo[p]||(Bo[p]=new RegExp("([\\s\\S]*?)(]*>)","i")),v=t.replace(d,function(t,n,r){return f=r.length,Ho(p)||"noscript"===p||(n=n.replace(//g,"$1").replace(//g,"$1")),Jo(p,n)&&(n=n.slice(1)),e.chars&&e.chars(n),""});l+=t.length-v.length,t=v,r(p,l-f,l)}else{var h=t.indexOf("<");if(0===h){if(Ao.test(t)){var m=t.indexOf("--\x3e");if(m>=0){e.shouldKeepComment&&e.comment(t.substring(4,m)),n(m+3);continue}}if(Oo.test(t)){var y=t.indexOf("]>");if(y>=0){n(y+2);continue}}var g=t.match(ko);if(g){n(g[0].length);continue}var _=t.match(xo);if(_){var b=l;n(_[0].length),r(_[1],b,l);continue}var $=function(){var e=t.match(Co);if(e){var r={tagName:e[1],attrs:[],start:l};n(e[0].length);for(var i,o;!(i=t.match(wo))&&(o=t.match(_o));)n(o[0].length),r.attrs.push(o);if(i)return r.unarySlash=i[1],n(i[0].length),r.end=l,r}}();if($){!function(t){var n=t.tagName,i=t.unarySlash;s&&("p"===o&&go(n)&&r(o),u(n)&&o===n&&r(n));for(var l=c(n)||!!i,f=t.attrs.length,p=new Array(f),d=0;d=0){for(w=t.slice(h);!(xo.test(w)||Co.test(w)||Ao.test(w)||Oo.test(w)||(x=w.indexOf("<",1))<0);)h+=x,w=t.slice(h);C=t.substring(0,h),n(h)}h<0&&(C=t,t=""),e.chars&&C&&e.chars(C)}if(t===i){e.chars&&e.chars(t);break}}r()}(t,{warn:To,expectHTML:e.expectHTML,isUnaryTag:e.isUnaryTag,canBeLeftOpenTag:e.canBeLeftOpenTag,shouldDecodeNewlines:e.shouldDecodeNewlines,shouldDecodeNewlinesForHref:e.shouldDecodeNewlinesForHref,shouldKeepComment:e.comments,start:function(t,a,u){var l=i&&i.ns||Do(t);Qn&&"svg"===l&&(a=function(t){for(var e=[],n=0;nc&&(s.push(o=t.slice(c,i)),a.push(JSON.stringify(o)));var u=ae(r[1].trim());a.push("_s("+u+")"),s.push({"@binding":u}),c=i+r[0].length}return c':'
',Ro.innerHTML.indexOf(" ")>0}var jn=Object.freeze({}),Nn=Object.prototype.toString,In=u("slot,component",!0),Ln=u("key,ref,slot,slot-scope,is"),Mn=Object.prototype.hasOwnProperty,Dn=/-(\w)/g,Pn=p(function(t){return t.replace(Dn,function(t,e){return e?e.toUpperCase():""})}),Fn=p(function(t){return t.charAt(0).toUpperCase()+t.slice(1)}),Rn=/\B([A-Z])/g,Hn=p(function(t){return t.replace(Rn,"-$1").toLowerCase()}),Bn=function(t,e,n){return!1},Un=function(t){return t},Vn="data-server-rendered",zn=["component","directive","filter"],Kn=["beforeCreate","created","beforeMount","mounted","beforeUpdate","updated","beforeDestroy","destroyed","activated","deactivated","errorCaptured"],Jn={optionMergeStrategies:Object.create(null),silent:!1,productionTip:!1,devtools:!1,performance:!1,errorHandler:null,warnHandler:null,ignoredElements:[],keyCodes:Object.create(null),isReservedTag:Bn,isReservedAttr:Bn,isUnknownElement:Bn,getTagNamespace:y,parsePlatformTagName:Un,mustUseProp:Bn,_lifecycleHooks:Kn},qn=/[^\w.$]/,Wn="__proto__"in{},Gn="undefined"!=typeof window,Zn="undefined"!=typeof WXEnvironment&&!!WXEnvironment.platform,Xn=Zn&&WXEnvironment.platform.toLowerCase(),Yn=Gn&&window.navigator.userAgent.toLowerCase(),Qn=Yn&&/msie|trident/.test(Yn),tr=Yn&&Yn.indexOf("msie 9.0")>0,er=Yn&&Yn.indexOf("edge/")>0,nr=Yn&&Yn.indexOf("android")>0||"android"===Xn,rr=Yn&&/iphone|ipad|ipod|ios/.test(Yn)||"ios"===Xn,ir=(Yn&&/chrome\/\d+/.test(Yn),{}.watch),or=!1;if(Gn)try{var ar={};Object.defineProperty(ar,"passive",{get:function(){or=!0}}),window.addEventListener("test-passive",null,ar)}catch(t){}var sr,cr,ur=function(){return void 0===sr&&(sr=!Gn&&"undefined"!=typeof global&&"server"===global.process.env.VUE_ENV),sr},lr=Gn&&window.__VUE_DEVTOOLS_GLOBAL_HOOK__,fr="undefined"!=typeof Symbol&&w(Symbol)&&"undefined"!=typeof Reflect&&w(Reflect.ownKeys);cr="undefined"!=typeof Set&&w(Set)?Set:function(){function t(){this.set=Object.create(null)}return t.prototype.has=function(t){return!0===this.set[t]},t.prototype.add=function(t){this.set[t]=!0},t.prototype.clear=function(){this.set=Object.create(null)},t}();var pr=y,dr=0,vr=function(){this.id=dr++,this.subs=[]};vr.prototype.addSub=function(t){this.subs.push(t)},vr.prototype.removeSub=function(t){l(this.subs,t)},vr.prototype.depend=function(){vr.target&&vr.target.addDep(this)},vr.prototype.notify=function(){for(var t=this.subs.slice(),e=0,n=t.length;eVr&&Fr[n].id>t.id;)n--;Fr.splice(n+1,0,t)}else Fr.push(t);Br||(Br=!0,q(ht))}}(this)},Kr.prototype.run=function(){if(this.active){var t=this.get();if(t!==this.value||i(t)||this.deep){var e=this.value;if(this.value=t,this.user)try{this.cb.call(this.vm,t,e)}catch(t){V(t,this.vm,'callback for watcher "'+this.expression+'"')}else this.cb.call(this.vm,t,e)}}},Kr.prototype.evaluate=function(){this.value=this.get(),this.dirty=!1},Kr.prototype.depend=function(){for(var t=this.deps.length;t--;)this.deps[t].depend()},Kr.prototype.teardown=function(){if(this.active){this.vm._isBeingDestroyed||l(this.vm._watchers,this);for(var t=this.deps.length;t--;)this.deps[t].removeSub(this);this.active=!1}};var Jr={enumerable:!0,configurable:!0,get:y,set:y},qr={lazy:!0};Nt(It.prototype);var Wr={init:function(t,n,r,i){if(!t.componentInstance||t.componentInstance._isDestroyed){(t.componentInstance=function(t,n,r,i){var o={_isComponent:!0,parent:n,_parentVnode:t,_parentElm:r||null,_refElm:i||null},a=t.data.inlineTemplate;return e(a)&&(o.render=a.render,o.staticRenderFns=a.staticRenderFns),new t.componentOptions.Ctor(o)}(t,Pr,r,i)).$mount(n?t.elm:void 0,n)}else if(t.data.keepAlive){var o=t;Wr.prepatch(o,o)}},prepatch:function(t,e){var n=e.componentOptions;!function(t,e,n,r,i){var o=!!(i||t.$options._renderChildren||r.data.scopedSlots||t.$scopedSlots!==jn);if(t.$options._parentVnode=r,t.$vnode=r,t._vnode&&(t._vnode.parent=r),t.$options._renderChildren=i,t.$attrs=r.data&&r.data.attrs||jn,t.$listeners=n||jn,e&&t.$options.props){Cr.shouldConvert=!1;for(var a=t._props,s=t.$options._propKeys||[],c=0;c1?v(n):n;for(var r=v(arguments,1),i=0,o=n.length;iparseInt(this.max)&&zt(a,s[0],s,this._vnode)),e.data.keepAlive=!0}return e||t&&t[0]}}};!function(t){var e={};e.get=function(){return Jn},Object.defineProperty(t,"config",e),t.util={warn:pr,extend:h,mergeOptions:F,defineReactive:E},t.set=j,t.delete=N,t.nextTick=q,t.options=Object.create(null),zn.forEach(function(e){t.options[e+"s"]=Object.create(null)}),t.options._base=t,h(t.options.components,ti),function(t){t.use=function(t){var e=this._installedPlugins||(this._installedPlugins=[]);if(e.indexOf(t)>-1)return this;var n=v(arguments,1);return n.unshift(this),"function"==typeof t.install?t.install.apply(t,n):"function"==typeof t&&t.apply(null,n),e.push(t),this}}(t),function(t){t.mixin=function(t){return this.options=F(this.options,t),this}}(t),Ht(t),function(t){zn.forEach(function(e){t[e]=function(t,n){return n?("component"===e&&o(n)&&(n.name=n.name||t,n=this.options._base.extend(n)),"directive"===e&&"function"==typeof n&&(n={bind:n,update:n}),this.options[e+"s"][t]=n,n):this.options[e+"s"][t]}})}(t)}(Rt),Object.defineProperty(Rt.prototype,"$isServer",{get:ur}),Object.defineProperty(Rt.prototype,"$ssrContext",{get:function(){return this.$vnode&&this.$vnode.ssrContext}}),Rt.version="2.5.13";var ei,ni,ri,ii,oi,ai,si,ci,ui=u("style,class"),li=u("input,textarea,option,select,progress"),fi=function(t,e,n){return"value"===n&&li(t)&&"button"!==e||"selected"===n&&"option"===t||"checked"===n&&"input"===t||"muted"===n&&"video"===t},pi=u("contenteditable,draggable,spellcheck"),di=u("allowfullscreen,async,autofocus,autoplay,checked,compact,controls,declare,default,defaultchecked,defaultmuted,defaultselected,defer,disabled,enabled,formnovalidate,hidden,indeterminate,inert,ismap,itemscope,loop,multiple,muted,nohref,noresize,noshade,novalidate,nowrap,open,pauseonexit,readonly,required,reversed,scoped,seamless,selected,sortable,translate,truespeed,typemustmatch,visible"),vi="http://www.w3.org/1999/xlink",hi=function(t){return":"===t.charAt(5)&&"xlink"===t.slice(0,5)},mi=function(t){return hi(t)?t.slice(6,t.length):""},yi=function(t){return null==t||!1===t},gi={svg:"http://www.w3.org/2000/svg",math:"http://www.w3.org/1998/Math/MathML"},_i=u("html,body,base,head,link,meta,style,title,address,article,aside,footer,header,h1,h2,h3,h4,h5,h6,hgroup,nav,section,div,dd,dl,dt,figcaption,figure,picture,hr,img,li,main,ol,p,pre,ul,a,b,abbr,bdi,bdo,br,cite,code,data,dfn,em,i,kbd,mark,q,rp,rt,rtc,ruby,s,samp,small,span,strong,sub,sup,time,u,var,wbr,area,audio,map,track,video,embed,object,param,source,canvas,script,noscript,del,ins,caption,col,colgroup,table,thead,tbody,td,th,tr,button,datalist,fieldset,form,input,label,legend,meter,optgroup,option,output,progress,select,textarea,details,dialog,menu,menuitem,summary,content,element,shadow,template,blockquote,iframe,tfoot"),bi=u("svg,animate,circle,clippath,cursor,defs,desc,ellipse,filter,font-face,foreignObject,g,glyph,image,line,marker,mask,missing-glyph,path,pattern,polygon,polyline,rect,switch,symbol,text,textpath,tspan,use,view",!0),$i=function(t){return _i(t)||bi(t)},Ci=Object.create(null),wi=u("text,number,password,search,email,tel,url"),xi=Object.freeze({createElement:function(t,e){var n=document.createElement(t);return"select"!==t?n:(e.data&&e.data.attrs&&void 0!==e.data.attrs.multiple&&n.setAttribute("multiple","multiple"),n)},createElementNS:function(t,e){return document.createElementNS(gi[t],e)},createTextNode:function(t){return document.createTextNode(t)},createComment:function(t){return document.createComment(t)},insertBefore:function(t,e,n){t.insertBefore(e,n)},removeChild:function(t,e){t.removeChild(e)},appendChild:function(t,e){t.appendChild(e)},parentNode:function(t){return t.parentNode},nextSibling:function(t){return t.nextSibling},tagName:function(t){return t.tagName},setTextContent:function(t,e){t.textContent=e},setAttribute:function(t,e,n){t.setAttribute(e,n)}}),ki={create:function(t,e){Xt(e)},update:function(t,e){t.data.ref!==e.data.ref&&(Xt(t,!0),Xt(e))},destroy:function(t){Xt(t,!0)}},Ai=new mr("",{},[]),Oi=["create","activate","update","remove","destroy"],Si={create:te,update:te,destroy:function(t){te(t,Ai)}},Ti=Object.create(null),Ei=[ki,Si],ji={create:re,update:re},Ni={create:oe,update:oe},Ii=/[\w).+\-_$\]]/,Li="__r",Mi="__c",Di={create:xe,update:xe},Pi={create:ke,update:ke},Fi=p(function(t){var e={},n=/:(.+)/;return t.split(/;(?![^(]*\))/g).forEach(function(t){if(t){var r=t.split(n);r.length>1&&(e[r[0].trim()]=r[1].trim())}}),e}),Ri=/^--/,Hi=/\s*!important$/,Bi=function(t,e,n){if(Ri.test(e))t.style.setProperty(e,n);else if(Hi.test(n))t.style.setProperty(e,n.replace(Hi,""),"important");else{var r=Vi(e);if(Array.isArray(n))for(var i=0,o=n.length;id?v(n,t(i[g+1])?null:i[g+1].elm,i,p,g,o):p>g&&m(0,r,f,d)}function _(r,i,o,a){if(r!==i){var s=i.elm=r.elm;if(n(r.isAsyncPlaceholder))e(i.asyncFactory.resolved)?$(r.elm,i,o):i.isAsyncPlaceholder=!0;else if(n(i.isStatic)&&n(r.isStatic)&&i.key===r.key&&(n(i.isCloned)||n(i.isOnce)))i.componentInstance=r.componentInstance;else{var c,u=i.data;e(u)&&e(c=u.hook)&&e(c=c.prepatch)&&c(r,i);var l=r.children,p=i.children;if(e(u)&&f(i)){for(c=0;c-1?Ci[t]=e.constructor===window.HTMLUnknownElement||e.constructor===window.HTMLElement:Ci[t]=/HTMLUnknownElement/.test(e.toString())},h(Rt.options.directives,ro),h(Rt.options.components,so),Rt.prototype.__patch__=Gn?eo:y,Rt.prototype.$mount=function(t,e){return t=t&&Gn?Zt(t):void 0,function(t,e,n){t.$el=e,t.$options.render||(t.$options.render=gr),vt(t,"beforeMount");var r;return r=function(){t._update(t._render(),n)},new Kr(t,r,y,null,!0),n=!1,null==t.$vnode&&(t._isMounted=!0,vt(t,"mounted")),t}(this,t,e)},Rt.nextTick(function(){Jn.devtools&&lr&&lr.emit("init",Rt)},0);var co,uo=/\{\{((?:.|\n)+?)\}\}/g,lo=/[-.*+?^${}()|[\]\/\\]/g,fo=p(function(t){var e=t[0].replace(lo,"\\$&"),n=t[1].replace(lo,"\\$&");return new RegExp(e+"((?:.|\\n)+?)"+n,"g")}),po={staticKeys:["staticClass"],transformNode:function(t,e){e.warn;var n=he(t,"class");n&&(t.staticClass=JSON.stringify(n));var r=ve(t,"class",!1);r&&(t.classBinding=r)},genData:function(t){var e="";return t.staticClass&&(e+="staticClass:"+t.staticClass+","),t.classBinding&&(e+="class:"+t.classBinding+","),e}},vo={staticKeys:["staticStyle"],transformNode:function(t,e){e.warn;var n=he(t,"style");n&&(t.staticStyle=JSON.stringify(Fi(n)));var r=ve(t,"style",!1);r&&(t.styleBinding=r)},genData:function(t){var e="";return t.staticStyle&&(e+="staticStyle:"+t.staticStyle+","),t.styleBinding&&(e+="style:("+t.styleBinding+"),"),e}},ho=function(t){return co=co||document.createElement("div"),co.innerHTML=t,co.textContent},mo=u("area,base,br,col,embed,frame,hr,img,input,isindex,keygen,link,meta,param,source,track,wbr"),yo=u("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr,source"),go=u("address,article,aside,base,blockquote,body,caption,col,colgroup,dd,details,dialog,div,dl,dt,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,head,header,hgroup,hr,html,legend,li,menuitem,meta,optgroup,option,param,rp,rt,source,style,summary,tbody,td,tfoot,th,thead,title,tr,track"),_o=/^\s*([^\s"'<>\/=]+)(?:\s*(=)\s*(?:"([^"]*)"+|'([^']*)'+|([^\s"'=<>`]+)))?/,bo="[a-zA-Z_][\\w\\-\\.]*",$o="((?:"+bo+"\\:)?"+bo+")",Co=new RegExp("^<"+$o),wo=/^\s*(\/?)>/,xo=new RegExp("^<\\/"+$o+"[^>]*>"),ko=/^]+>/i,Ao=/^ 16 | 17 | 18 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 7 | 8 | 23 | -------------------------------------------------------------------------------- /src/assets/calendar.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable no-redeclare */ 2 | /* eslint-disable no-unreachable */ 3 | /* eslint-disable no-unused-vars */ 4 | /** 5 | * @1900-2100区间内的公历、农历互转 6 | * @charset UTF-8 7 | * @Author Jea杨(JJonline@JJonline.Cn) 8 | * @Time 2014-7-21 9 | * @Time 2016-8-13 Fixed 2033hex、Attribution Annals 10 | * @Time 2016-9-25 Fixed lunar LeapMonth Param Bug 11 | * @Time 2017-7-24 Fixed use getTerm Func Param Error.use solar year,NOT lunar year 12 | * @Version 1.0.3 13 | * @公历转农历:calendar.solar2lunar(1987,11,01); //[you can ignore params of prefix 0] 14 | * @农历转公历:calendar.lunar2solar(1987,09,10); //[you can ignore params of prefix 0] 15 | */ 16 | var calendar = { 17 | 18 | /** 19 | * 农历1900-2100的润大小信息表 20 | * @Array Of Property 21 | * @return Hex 22 | */ 23 | lunarInfo:[0x04bd8,0x04ae0,0x0a570,0x054d5,0x0d260,0x0d950,0x16554,0x056a0,0x09ad0,0x055d2,//1900-1909 24 | 0x04ae0,0x0a5b6,0x0a4d0,0x0d250,0x1d255,0x0b540,0x0d6a0,0x0ada2,0x095b0,0x14977,//1910-1919 25 | 0x04970,0x0a4b0,0x0b4b5,0x06a50,0x06d40,0x1ab54,0x02b60,0x09570,0x052f2,0x04970,//1920-1929 26 | 0x06566,0x0d4a0,0x0ea50,0x16a95,0x05ad0,0x02b60,0x186e3,0x092e0,0x1c8d7,0x0c950,//1930-1939 27 | 0x0d4a0,0x1d8a6,0x0b550,0x056a0,0x1a5b4,0x025d0,0x092d0,0x0d2b2,0x0a950,0x0b557,//1940-1949 28 | 0x06ca0,0x0b550,0x15355,0x04da0,0x0a5b0,0x14573,0x052b0,0x0a9a8,0x0e950,0x06aa0,//1950-1959 29 | 0x0aea6,0x0ab50,0x04b60,0x0aae4,0x0a570,0x05260,0x0f263,0x0d950,0x05b57,0x056a0,//1960-1969 30 | 0x096d0,0x04dd5,0x04ad0,0x0a4d0,0x0d4d4,0x0d250,0x0d558,0x0b540,0x0b6a0,0x195a6,//1970-1979 31 | 0x095b0,0x049b0,0x0a974,0x0a4b0,0x0b27a,0x06a50,0x06d40,0x0af46,0x0ab60,0x09570,//1980-1989 32 | 0x04af5,0x04970,0x064b0,0x074a3,0x0ea50,0x06b58,0x05ac0,0x0ab60,0x096d5,0x092e0,//1990-1999 33 | 0x0c960,0x0d954,0x0d4a0,0x0da50,0x07552,0x056a0,0x0abb7,0x025d0,0x092d0,0x0cab5,//2000-2009 34 | 0x0a950,0x0b4a0,0x0baa4,0x0ad50,0x055d9,0x04ba0,0x0a5b0,0x15176,0x052b0,0x0a930,//2010-2019 35 | 0x07954,0x06aa0,0x0ad50,0x05b52,0x04b60,0x0a6e6,0x0a4e0,0x0d260,0x0ea65,0x0d530,//2020-2029 36 | 0x05aa0,0x076a3,0x096d0,0x04afb,0x04ad0,0x0a4d0,0x1d0b6,0x0d250,0x0d520,0x0dd45,//2030-2039 37 | 0x0b5a0,0x056d0,0x055b2,0x049b0,0x0a577,0x0a4b0,0x0aa50,0x1b255,0x06d20,0x0ada0,//2040-2049 38 | /**Add By JJonline@JJonline.Cn**/ 39 | 0x14b63,0x09370,0x049f8,0x04970,0x064b0,0x168a6,0x0ea50, 0x06b20,0x1a6c4,0x0aae0,//2050-2059 40 | 0x092e0,0x0d2e3,0x0c960,0x0d557,0x0d4a0,0x0da50,0x05d55,0x056a0,0x0a6d0,0x055d4,//2060-2069 41 | 0x052d0,0x0a9b8,0x0a950,0x0b4a0,0x0b6a6,0x0ad50,0x055a0,0x0aba4,0x0a5b0,0x052b0,//2070-2079 42 | 0x0b273,0x06930,0x07337,0x06aa0,0x0ad50,0x14b55,0x04b60,0x0a570,0x054e4,0x0d160,//2080-2089 43 | 0x0e968,0x0d520,0x0daa0,0x16aa6,0x056d0,0x04ae0,0x0a9d4,0x0a2d0,0x0d150,0x0f252,//2090-2099 44 | 0x0d520],//2100 45 | 46 | /** 47 | * 公历每个月份的天数普通表 48 | * @Array Of Property 49 | * @return Number 50 | */ 51 | solarMonth:[31,28,31,30,31,30,31,31,30,31,30,31], 52 | 53 | /** 54 | * 天干地支之天干速查表 55 | * @Array Of Property trans["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"] 56 | * @return Cn string 57 | */ 58 | Gan:["\u7532","\u4e59","\u4e19","\u4e01","\u620a","\u5df1","\u5e9a","\u8f9b","\u58ec","\u7678"], 59 | 60 | /** 61 | * 天干地支之地支速查表 62 | * @Array Of Property 63 | * @trans["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"] 64 | * @return Cn string 65 | */ 66 | Zhi:["\u5b50","\u4e11","\u5bc5","\u536f","\u8fb0","\u5df3","\u5348","\u672a","\u7533","\u9149","\u620c","\u4ea5"], 67 | 68 | /** 69 | * 天干地支之地支速查表<=>生肖 70 | * @Array Of Property 71 | * @trans["鼠","牛","虎","兔","龙","蛇","马","羊","猴","鸡","狗","猪"] 72 | * @return Cn string 73 | */ 74 | Animals:["\u9f20","\u725b","\u864e","\u5154","\u9f99","\u86c7","\u9a6c","\u7f8a","\u7334","\u9e21","\u72d7","\u732a"], 75 | 76 | /** 77 | * 阳历节日 78 | */ 79 | festival: { 80 | '1-1': {title: '元旦'}, 81 | '2-14': {title: '情人节'}, 82 | '3-5': {title: '雷锋日'}, 83 | '3-8': {title: '妇女节'}, 84 | '3-12': {title: '植树节'}, 85 | '4-1': {title: '愚人节'}, 86 | '4-22': {title: '地球日'}, 87 | '5-1': {title: '劳动节'}, 88 | '5-4': {title: '青年节'}, 89 | '5-12': {title: '护士节'}, 90 | '6-1': {title: '儿童节'}, 91 | '7-1': {title: '建党节'}, 92 | '8-1': {title: '建军节'}, 93 | '9-10': {title: '教师节'}, 94 | '10-1': { title: '国庆节' }, 95 | '12-24': {title: '平安夜'}, 96 | '12-25': {title: '圣诞节'}, 97 | }, 98 | 99 | /** 100 | * 农历节日 101 | */ 102 | lfestival: { 103 | '12-30': {title: '除夕'}, 104 | '1-1': {title: '春节'}, 105 | '1-15': {title: '元宵节'}, 106 | '2-2': {title: '龙抬头'}, 107 | '5-5': {title: '端午节'}, 108 | '7-7': {title: '七夕节'}, 109 | '7-15': {title: '中元节'}, 110 | '8-15': {title: '中秋节'}, 111 | '9-9': {title: '重阳节'}, 112 | '12-8': {title: '腊八节'}, 113 | '12-23': {title: '北方小年'}, 114 | '12-24': {title: '南方小年'} 115 | }, 116 | 117 | /** 118 | * 返回默认定义的阳历节日 119 | */ 120 | getFestival(){ 121 | return this.festival 122 | }, 123 | 124 | /** 125 | * 返回默认定义的内容里节日 126 | */ 127 | getLunarFestival(){ 128 | return this.lfestival 129 | }, 130 | 131 | /** 132 | * 133 | * @param {Object} 按照festival的格式输入数据,设置阳历节日 134 | */ 135 | setFestival(param={}){ 136 | this.festival = param 137 | }, 138 | 139 | /** 140 | * 141 | * @param {Object} 按照lfestival的格式输入数据,设置农历节日 142 | */ 143 | setLunarFestival(param={}){ 144 | this.lfestival = param 145 | }, 146 | 147 | /** 148 | * 24节气速查表 149 | * @Array Of Property 150 | * @trans["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"] 151 | * @return Cn string 152 | */ 153 | solarTerm:["\u5c0f\u5bd2","\u5927\u5bd2","\u7acb\u6625","\u96e8\u6c34","\u60ca\u86f0","\u6625\u5206","\u6e05\u660e","\u8c37\u96e8","\u7acb\u590f","\u5c0f\u6ee1","\u8292\u79cd","\u590f\u81f3","\u5c0f\u6691","\u5927\u6691","\u7acb\u79cb","\u5904\u6691","\u767d\u9732","\u79cb\u5206","\u5bd2\u9732","\u971c\u964d","\u7acb\u51ac","\u5c0f\u96ea","\u5927\u96ea","\u51ac\u81f3"], 154 | 155 | /** 156 | * 1900-2100各年的24节气日期速查表 157 | * @Array Of Property 158 | * @return 0x string For splice 159 | */ 160 | sTermInfo:['9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f', 161 | '97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e', 162 | '97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f','b027097bd097c36b0b6fc9274c91aa', 163 | '97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f','97bd0b06bdb0722c965ce1cfcc920f', 164 | 'b027097bd097c36b0b6fc9274c91aa','9778397bd19801ec9210c965cc920e','97b6b97bd19801ec95f8c965cc920f', 165 | '97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2','9778397bd197c36c9210c9274c91aa', 166 | '97b6b97bd19801ec95f8c965cc920e','97bd09801d98082c95f8e1cfcc920f','97bd097bd097c36b0b6fc9210c8dc2', 167 | '9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec95f8c965cc920e','97bcf97c3598082c95f8e1cfcc920f', 168 | '97bd097bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e', 169 | '97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa', 170 | '97b6b97bd19801ec9210c965cc920e','97bcf97c3598082c95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722', 171 | '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f', 172 | '97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e', 173 | '97bcf97c359801ec95f8c965cc920f','97bd097bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa', 174 | '97b6b97bd19801ec9210c965cc920e','97bcf97c359801ec95f8c965cc920f','97bd097bd07f595b0b6fc920fb0722', 175 | '9778397bd097c36b0b6fc9210c8dc2','9778397bd19801ec9210c9274c920e','97b6b97bd19801ec95f8c965cc920f', 176 | '97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e', 177 | '97b6b97bd19801ec95f8c965cc920f','97bd07f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2', 178 | '9778397bd097c36c9210c9274c91aa','97b6b97bd19801ec9210c965cc920e','97bd07f1487f595b0b0bc920fb0722', 179 | '7f0e397bd097c36b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e', 180 | '97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa', 181 | '97b6b97bd19801ec9210c965cc920e','97bcf7f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722', 182 | '9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e','97bcf7f1487f531b0b0bb0b6fb0722', 183 | '7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b97bd19801ec9210c965cc920e', 184 | '97bcf7f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa', 185 | '97b6b97bd19801ec9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722', 186 | '9778397bd097c36b0b6fc9210c91aa','97b6b97bd197c36c9210c9274c920e','97bcf7f0e47f531b0b0bb0b6fb0722', 187 | '7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','9778397bd097c36c9210c9274c920e', 188 | '97b6b7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c36b0b6fc9210c8dc2', 189 | '9778397bd097c36b0b70c9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722', 190 | '7f0e397bd097c35b0b6fc9210c8dc2','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721', 191 | '7f0e27f1487f595b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa', 192 | '97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722', 193 | '9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722', 194 | '7f0e397bd097c35b0b6fc920fb0722','9778397bd097c36b0b6fc9274c91aa','97b6b7f0e47f531b0723b0b6fb0721', 195 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9274c91aa', 196 | '97b6b7f0e47f531b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722', 197 | '9778397bd097c36b0b6fc9210c91aa','97b6b7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722', 198 | '7f0e397bd07f595b0b0bc920fb0722','9778397bd097c36b0b6fc9210c8dc2','977837f0e37f149b0723b0787b0721', 199 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e37f5307f595b0b0bc920fb0722','7f0e397bd097c35b0b6fc9210c8dc2', 200 | '977837f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0721','7f0e37f1487f595b0b0bb0b6fb0722', 201 | '7f0e397bd097c35b0b6fc9210c8dc2','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721', 202 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722','977837f0e37f14998082b0787b06bd', 203 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd097c35b0b6fc920fb0722', 204 | '977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722', 205 | '7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721', 206 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14998082b0787b06bd', 207 | '7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0b0bb0b6fb0722','7f0e397bd07f595b0b0bc920fb0722', 208 | '977837f0e37f14998082b0723b06bd','7f07e7f0e37f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722', 209 | '7f0e397bd07f595b0b0bc920fb0722','977837f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b0721', 210 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f595b0b0bb0b6fb0722','7f0e37f0e37f14898082b0723b02d5', 211 | '7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e37f1487f531b0b0bb0b6fb0722', 212 | '7f0e37f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721', 213 | '7f0e37f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd', 214 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e37f14898082b072297c35', 215 | '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722', 216 | '7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f149b0723b0787b0721', 217 | '7f0e27f1487f531b0b0bb0b6fb0722','7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14998082b0723b06bd', 218 | '7f07e7f0e47f149b0723b0787b0721','7f0e27f0e47f531b0723b0b6fb0722','7f0e37f0e366aa89801eb072297c35', 219 | '7ec967f0e37f14998082b0723b06bd','7f07e7f0e37f14998083b0787b0721','7f0e27f0e47f531b0723b0b6fb0722', 220 | '7f0e37f0e366aa89801eb072297c35','7ec967f0e37f14898082b0723b02d5','7f07e7f0e37f14998082b0787b0721', 221 | '7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66aa89801e9808297c35','665f67f0e37f14898082b0723b02d5', 222 | '7ec967f0e37f14998082b0787b0721','7f07e7f0e47f531b0723b0b6fb0722','7f0e36665b66a449801e9808297c35', 223 | '665f67f0e37f14898082b0723b02d5','7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721', 224 | '7f0e36665b66a449801e9808297c35','665f67f0e37f14898082b072297c35','7ec967f0e37f14998082b0787b06bd', 225 | '7f07e7f0e47f531b0723b0b6fb0721','7f0e26665b66a449801e9808297c35','665f67f0e37f1489801eb072297c35', 226 | '7ec967f0e37f14998082b0787b06bd','7f07e7f0e47f531b0723b0b6fb0721','7f0e27f1487f531b0b0bb0b6fb0722'], 227 | 228 | /** 229 | * 数字转中文速查表 230 | * @Array Of Property 231 | * @trans ['日','一','二','三','四','五','六','七','八','九','十'] 232 | * @return Cn string 233 | */ 234 | nStr1:["\u65e5","\u4e00","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341"], 235 | 236 | /** 237 | * 日期转农历称呼速查表 238 | * @Array Of Property 239 | * @trans ['初','十','廿','卅'] 240 | * @return Cn string 241 | */ 242 | nStr2:["\u521d","\u5341","\u5eff","\u5345"], 243 | 244 | /** 245 | * 月份转农历称呼速查表 246 | * @Array Of Property 247 | * @trans ['正','一','二','三','四','五','六','七','八','九','十','冬','腊'] 248 | * @return Cn string 249 | */ 250 | nStr3:["\u6b63","\u4e8c","\u4e09","\u56db","\u4e94","\u516d","\u4e03","\u516b","\u4e5d","\u5341","\u51ac","\u814a"], 251 | 252 | /** 253 | * 返回农历y年一整年的总天数 254 | * @param lunar Year 255 | * @return Number 256 | * @eg:var count = calendar.lYearDays(1987) ;//count=387 257 | */ 258 | lYearDays:function(y) { 259 | var i, sum = 348; 260 | for(i=0x8000; i>0x8; i>>=1) { sum += (this.lunarInfo[y-1900] & i)? 1: 0; } 261 | return(sum+this.leapDays(y)); 262 | }, 263 | 264 | /** 265 | * 返回农历y年闰月是哪个月;若y年没有闰月 则返回0 266 | * @param lunar Year 267 | * @return Number (0-12) 268 | * @eg:var leapMonth = calendar.leapMonth(1987) ;//leapMonth=6 269 | */ 270 | leapMonth:function(y) { //闰字编码 \u95f0 271 | return(this.lunarInfo[y-1900] & 0xf); 272 | }, 273 | 274 | /** 275 | * 返回农历y年闰月的天数 若该年没有闰月则返回0 276 | * @param lunar Year 277 | * @return Number (0、29、30) 278 | * @eg:var leapMonthDay = calendar.leapDays(1987) ;//leapMonthDay=29 279 | */ 280 | leapDays:function(y) { 281 | if(this.leapMonth(y)) { 282 | return((this.lunarInfo[y-1900] & 0x10000)? 30: 29); 283 | } 284 | return(0); 285 | }, 286 | 287 | /** 288 | * 返回农历y年m月(非闰月)的总天数,计算m为闰月时的天数请使用leapDays方法 289 | * @param lunar Year 290 | * @return Number (-1、29、30) 291 | * @eg:var MonthDay = calendar.monthDays(1987,9) ;//MonthDay=29 292 | */ 293 | monthDays:function(y,m) { 294 | if(m>12 || m<1) {return -1}//月份参数从1至12,参数错误返回-1 295 | return( (this.lunarInfo[y-1900] & (0x10000>>m))? 30: 29 ); 296 | }, 297 | 298 | /** 299 | * 返回公历(!)y年m月的天数 300 | * @param solar Year 301 | * @return Number (-1、28、29、30、31) 302 | * @eg:var solarMonthDay = calendar.leapDays(1987) ;//solarMonthDay=30 303 | */ 304 | solarDays:function(y,m) { 305 | if(m>12 || m<1) {return -1} //若参数错误 返回-1 306 | var ms = m-1; 307 | if(ms==1) { //2月份的闰平规律测算后确认返回28或29 308 | return(((y%4 == 0) && (y%100 != 0) || (y%400 == 0))? 29: 28); 309 | }else { 310 | return(this.solarMonth[ms]); 311 | } 312 | }, 313 | 314 | /** 315 | * 农历年份转换为干支纪年 316 | * @param lYear 农历年的年份数 317 | * @return Cn string 318 | */ 319 | toGanZhiYear:function(lYear) { 320 | var ganKey = (lYear - 3) % 10; 321 | var zhiKey = (lYear - 3) % 12; 322 | if(ganKey == 0) ganKey = 10;//如果余数为0则为最后一个天干 323 | if(zhiKey == 0) zhiKey = 12;//如果余数为0则为最后一个地支 324 | return this.Gan[ganKey-1] + this.Zhi[zhiKey-1]; 325 | 326 | }, 327 | 328 | /** 329 | * 公历月、日判断所属星座 330 | * @param cMonth [description] 331 | * @param cDay [description] 332 | * @return Cn string 333 | */ 334 | toAstro:function(cMonth,cDay) { 335 | var s = "\u9b54\u7faf\u6c34\u74f6\u53cc\u9c7c\u767d\u7f8a\u91d1\u725b\u53cc\u5b50\u5de8\u87f9\u72ee\u5b50\u5904\u5973\u5929\u79e4\u5929\u874e\u5c04\u624b\u9b54\u7faf"; 336 | var arr = [20,19,21,21,21,22,23,23,23,23,22,22]; 337 | return s.substr(cMonth*2 - (cDay < arr[cMonth-1] ? 2 : 0),2) + "\u5ea7";//座 338 | }, 339 | 340 | /** 341 | * 传入offset偏移量返回干支 342 | * @param offset 相对甲子的偏移量 343 | * @return Cn string 344 | */ 345 | toGanZhi:function(offset) { 346 | return this.Gan[offset%10] + this.Zhi[offset%12]; 347 | }, 348 | 349 | /** 350 | * 传入公历(!)y年获得该年第n个节气的公历日期 351 | * @param y公历年(1900-2100);n二十四节气中的第几个节气(1~24);从n=1(小寒)算起 352 | * @return day Number 353 | * @eg:var _24 = calendar.getTerm(1987,3) ;//_24=4;意即1987年2月4日立春 354 | */ 355 | getTerm:function(y,n) { 356 | if(y<1900 || y>2100) {return -1;} 357 | if(n<1 || n>24) {return -1;} 358 | var _table = this.sTermInfo[y-1900]; 359 | var _info = [ 360 | parseInt('0x'+_table.substr(0,5)).toString() , 361 | parseInt('0x'+_table.substr(5,5)).toString(), 362 | parseInt('0x'+_table.substr(10,5)).toString(), 363 | parseInt('0x'+_table.substr(15,5)).toString(), 364 | parseInt('0x'+_table.substr(20,5)).toString(), 365 | parseInt('0x'+_table.substr(25,5)).toString() 366 | ]; 367 | var _calday = [ 368 | _info[0].substr(0,1), 369 | _info[0].substr(1,2), 370 | _info[0].substr(3,1), 371 | _info[0].substr(4,2), 372 | 373 | _info[1].substr(0,1), 374 | _info[1].substr(1,2), 375 | _info[1].substr(3,1), 376 | _info[1].substr(4,2), 377 | 378 | _info[2].substr(0,1), 379 | _info[2].substr(1,2), 380 | _info[2].substr(3,1), 381 | _info[2].substr(4,2), 382 | 383 | _info[3].substr(0,1), 384 | _info[3].substr(1,2), 385 | _info[3].substr(3,1), 386 | _info[3].substr(4,2), 387 | 388 | _info[4].substr(0,1), 389 | _info[4].substr(1,2), 390 | _info[4].substr(3,1), 391 | _info[4].substr(4,2), 392 | 393 | _info[5].substr(0,1), 394 | _info[5].substr(1,2), 395 | _info[5].substr(3,1), 396 | _info[5].substr(4,2), 397 | ]; 398 | return parseInt(_calday[n-1]); 399 | }, 400 | 401 | /** 402 | * 传入农历数字月份返回汉语通俗表示法 403 | * @param lunar month 404 | * @return Cn string 405 | * @eg:var cnMonth = calendar.toChinaMonth(12) ;//cnMonth='腊月' 406 | */ 407 | toChinaMonth:function(m) { // 月 => \u6708 408 | if(m>12 || m<1) {return -1} //若参数错误 返回-1 409 | var s = this.nStr3[m-1]; 410 | s+= "\u6708";//加上月字 411 | return s; 412 | }, 413 | 414 | /** 415 | * 传入农历日期数字返回汉字表示法 416 | * @param lunar day 417 | * @return Cn string 418 | * @eg:var cnDay = calendar.toChinaDay(21) ;//cnMonth='廿一' 419 | */ 420 | toChinaDay:function(d){ //日 => \u65e5 421 | var s; 422 | switch (d) { 423 | case 10: 424 | s = '\u521d\u5341'; break; 425 | case 20: 426 | s = '\u4e8c\u5341'; break; 427 | break; 428 | case 30: 429 | s = '\u4e09\u5341'; break; 430 | break; 431 | default : 432 | s = this.nStr2[Math.floor(d/10)]; 433 | s += this.nStr1[d%10]; 434 | } 435 | return(s); 436 | }, 437 | 438 | /** 439 | * 年份转生肖[!仅能大致转换] => 精确划分生肖分界线是“立春” 440 | * @param y year 441 | * @return Cn string 442 | * @eg:var animal = calendar.getAnimal(1987) ;//animal='兔' 443 | */ 444 | getAnimal: function(y) { 445 | return this.Animals[(y - 4) % 12] 446 | }, 447 | 448 | /** 449 | * 传入阳历年月日获得详细的公历、农历object信息 <=>JSON 450 | * @param y solar year 451 | * @param m solar month 452 | * @param d solar day 453 | * @return JSON object 454 | * @eg:console.log(calendar.solar2lunar(1987,11,01)); 455 | */ 456 | solar2lunar:function (y,m,d) { //参数区间1900.1.31~2100.12.31 457 | y = parseInt(y) 458 | m = parseInt(m) 459 | d = parseInt(d) 460 | //年份限定、上限 461 | if(y<1900 || y>2100) { 462 | return -1;// undefined转换为数字变为NaN 463 | } 464 | //公历传参最下限 465 | if(y==1900&&m==1&&d<31) { 466 | return -1; 467 | } 468 | //未传参 获得当天 469 | if(!y) { 470 | var objDate = new Date(); 471 | }else { 472 | var objDate = new Date(y,parseInt(m)-1,d) 473 | } 474 | var i, leap=0, temp=0; 475 | //修正ymd参数 476 | var y = objDate.getFullYear(), 477 | m = objDate.getMonth()+1, 478 | d = objDate.getDate(); 479 | var offset = (Date.UTC(objDate.getFullYear(),objDate.getMonth(),objDate.getDate()) - Date.UTC(1900,0,31))/86400000; 480 | for(i=1900; i<2101 && offset>0; i++) { 481 | temp = this.lYearDays(i); 482 | offset -= temp; 483 | } 484 | if(offset<0) { 485 | offset+=temp; i--; 486 | } 487 | 488 | //是否今天 489 | var isTodayObj = new Date(), 490 | isToday = false; 491 | if(isTodayObj.getFullYear()==y && isTodayObj.getMonth()+1==m && isTodayObj.getDate()==d) { 492 | isToday = true; 493 | } 494 | //星期几 495 | var nWeek = objDate.getDay(), 496 | cWeek = this.nStr1[nWeek]; 497 | //数字表示周几顺应天朝周一开始的惯例 498 | if(nWeek==0) { 499 | nWeek = 7; 500 | } 501 | //农历年 502 | var year = i; 503 | var leap = this.leapMonth(i); //闰哪个月 504 | var isLeap = false; 505 | 506 | //效验闰月 507 | for(i=1; i<13 && offset>0; i++) { 508 | //闰月 509 | if(leap>0 && i==(leap+1) && isLeap==false){ 510 | --i; 511 | isLeap = true; temp = this.leapDays(year); //计算农历闰月天数 512 | } 513 | else{ 514 | temp = this.monthDays(year, i);//计算农历普通月天数 515 | } 516 | //解除闰月 517 | if(isLeap==true && i==(leap+1)) { isLeap = false; } 518 | offset -= temp; 519 | } 520 | // 闰月导致数组下标重叠取反 521 | if(offset==0 && leap>0 && i==leap+1) 522 | { 523 | if(isLeap){ 524 | isLeap = false; 525 | }else{ 526 | isLeap = true; --i; 527 | } 528 | } 529 | if(offset<0) 530 | { 531 | offset += temp; --i; 532 | } 533 | //农历月 534 | var month = i; 535 | //农历日 536 | var day = offset + 1; 537 | //天干地支处理 538 | var sm = m-1; 539 | var gzY = this.toGanZhiYear(year); 540 | 541 | // 当月的两个节气 542 | // bugfix-2017-7-24 11:03:38 use lunar Year Param `y` Not `year` 543 | var firstNode = this.getTerm(y,(m*2-1));//返回当月「节」为几日开始 544 | var secondNode = this.getTerm(y,(m*2));//返回当月「节」为几日开始 545 | 546 | // 依据12节气修正干支月 547 | var gzM = this.toGanZhi((y-1900)*12+m+11); 548 | if(d>=firstNode) { 549 | gzM = this.toGanZhi((y-1900)*12+m+12); 550 | } 551 | 552 | //传入的日期的节气与否 553 | var isTerm = false; 554 | var Term = null; 555 | if(firstNode==d) { 556 | isTerm = true; 557 | Term = this.solarTerm[m*2-2]; 558 | } 559 | if(secondNode==d) { 560 | isTerm = true; 561 | Term = this.solarTerm[m*2-1]; 562 | } 563 | //日柱 当月一日与 1900/1/1 相差天数 564 | var dayCyclical = Date.UTC(y,sm,1,0,0,0,0)/86400000+25567+10; 565 | var gzD = this.toGanZhi(dayCyclical+d-1); 566 | //该日期所属的星座 567 | var astro = this.toAstro(m,d); 568 | 569 | var solarDate = y+'-'+m+'-'+d 570 | var lunarDate = year+'-'+month+'-'+day 571 | 572 | var festival = this.festival 573 | var lfestival = this.lfestival 574 | 575 | var festivalDate = m+'-'+d 576 | var lunarFestivalDate = month+'-'+day 577 | 578 | return { 579 | date: solarDate, 580 | lunarDate: lunarDate, 581 | festival: festival[festivalDate] ? festival[festivalDate].title : null, 582 | lunarFestival: lfestival[lunarFestivalDate] ? lfestival[lunarFestivalDate].title : null, 583 | 'lYear':year, 584 | 'lMonth':month, 585 | 'lDay':day, 586 | 'Animal':this.getAnimal(year), 587 | 'IMonthCn':(isLeap?"\u95f0":'')+this.toChinaMonth(month), 588 | 'IDayCn':this.toChinaDay(day), 589 | 'cYear':y, 590 | 'cMonth':m, 591 | 'cDay':d, 592 | 'gzYear':gzY, 593 | 'gzMonth':gzM, 594 | 'gzDay':gzD, 595 | 'isToday':isToday, 596 | 'isLeap':isLeap, 597 | 'nWeek':nWeek, 598 | 'ncWeek':"\u661f\u671f"+cWeek, 599 | 'isTerm':isTerm, 600 | 'Term':Term, 601 | 'astro':astro 602 | }; 603 | }, 604 | 605 | /** 606 | * 传入农历年月日以及传入的月份是否闰月获得详细的公历、农历object信息 <=>JSON 607 | * @param y lunar year 608 | * @param m lunar month 609 | * @param d lunar day 610 | * @param isLeapMonth lunar month is leap or not.[如果是农历闰月第四个参数赋值true即可] 611 | * @return JSON object 612 | * @eg:console.log(calendar.lunar2solar(1987,9,10)); 613 | */ 614 | lunar2solar:function(y,m,d,isLeapMonth) { //参数区间1900.1.31~2100.12.1 615 | y = parseInt(y) 616 | m = parseInt(m) 617 | d = parseInt(d) 618 | var isLeapMonth = !!isLeapMonth; 619 | var leapOffset = 0; 620 | var leapMonth = this.leapMonth(y); 621 | var leapDay = this.leapDays(y); 622 | if(isLeapMonth&&(leapMonth!=m)) {return -1;}//传参要求计算该闰月公历 但该年得出的闰月与传参的月份并不同 623 | if(y==2100&&m==12&&d>1 || y==1900&&m==1&&d<31) {return -1;}//超出了最大极限值 624 | var day = this.monthDays(y,m); 625 | var _day = day; 626 | //bugFix 2016-9-25 627 | //if month is leap, _day use leapDays method 628 | if(isLeapMonth) { 629 | _day = this.leapDays(y,m); 630 | } 631 | if(y < 1900 || y > 2100 || d > _day) {return -1;}//参数合法性效验 632 | 633 | //计算农历的时间差 634 | var offset = 0; 635 | for(var i=1900;i0) { 643 | offset+=this.leapDays(y);isAdd = true; 644 | } 645 | } 646 | offset+=this.monthDays(y,i); 647 | } 648 | //转换闰月农历 需补充该年闰月的前一个月的时差 649 | if(isLeapMonth) {offset+=day;} 650 | //1900年农历正月一日的公历时间为1900年1月30日0时0分0秒(该时间也是本农历的最开始起始点) 651 | var stmap = Date.UTC(1900,1,30,0,0,0); 652 | var calObj = new Date((offset+d-31)*86400000+stmap); 653 | var cY = calObj.getUTCFullYear(); 654 | var cM = calObj.getUTCMonth()+1; 655 | var cD = calObj.getUTCDate(); 656 | 657 | return this.solar2lunar(cY,cM,cD); 658 | } 659 | }; 660 | export default calendar; -------------------------------------------------------------------------------- /src/assets/styles.scss: -------------------------------------------------------------------------------- 1 | $--color-primary: #1890FF !default; 2 | $--color-white: #fff!default; 3 | $--color-success:#66BF16 !default; 4 | $--calendar-weekend-background-color :#efefef !default; 5 | $--border-color-base:#D2D2D2 !default; 6 | $--calendar-selected-background-color: mix($--color-white, $--color-primary, 90%) !default; 7 | $--calendar-selected-font-color :$--color-primary; 8 | $--color-success-lighter : mix($--color-white, $--color-success, 90%) !default; 9 | $--background-color-darken: #E5E5E5 !default; 10 | $--color-text-placeholder: #999999 !default; 11 | 12 | @mixin float($float:left) { 13 | float: $float; 14 | display: inline; 15 | } 16 | 17 | // clear 18 | @mixin clear { 19 | *zoom: 1; 20 | &:before, 21 | &:after { 22 | content: ""; 23 | display: table; 24 | height: 0; 25 | } 26 | &:after { 27 | clear: both; 28 | } 29 | } 30 | .calendar-pro { 31 | background-color:#fff; 32 | width: 100%; 33 | height: 100%; 34 | &__title { 35 | @include clear; 36 | margin-bottom: 20px; 37 | } 38 | &__title-info { 39 | @include float; 40 | color: #17233d; 41 | font-size: 18px; 42 | } 43 | &__tool{ 44 | @include float(right); 45 | position: relative; 46 | display: inline-block; 47 | vertical-align: middle; 48 | button{ 49 | padding:5px 15px; 50 | border:1px solid #dcdee2; 51 | color:#515a6e; 52 | background-color: transparent; 53 | position: relative; 54 | } 55 | button:hover{ 56 | color: #57a3f3; 57 | background-color: #fff; 58 | border-color: #57a3f3; 59 | cursor: pointer; 60 | z-index: 2; 61 | } 62 | button:first-child{ 63 | margin-left: 0px; 64 | } 65 | button+button{ 66 | margin-left: -1px; 67 | } 68 | } 69 | &.showWeek{ 70 | .weekend{ 71 | background-color: $--calendar-weekend-background-color; 72 | } 73 | } 74 | &__body { 75 | table{ 76 | border-collapse:collapse; 77 | th{ 78 | padding: 10px 0; 79 | font-weight: normal; 80 | } 81 | td{ 82 | position: relative; 83 | border: 1px solid $--border-color-base; 84 | width: 300px; 85 | cursor: pointer; 86 | &:hover{ 87 | .day-box{ 88 | background-color: $--calendar-selected-background-color; 89 | } 90 | } 91 | .day-box{ 92 | position: relative; 93 | height: 68px; 94 | padding: 10px; 95 | font-size: 14px; 96 | &.highlighter{ 97 | background-color: $--color-success-lighter; 98 | .info-date{ 99 | color: $--color-success; 100 | } 101 | } 102 | &.select{ 103 | width: auto; 104 | background-color: $--calendar-selected-background-color; 105 | .info-date{ 106 | color:$--calendar-selected-font-color; 107 | } 108 | } 109 | &.disabled{ 110 | cursor: not-allowed; 111 | background-color: $--background-color-darken; 112 | color: $--color-text-placeholder; 113 | } 114 | &.other-month-day{ 115 | opacity: 0.6; 116 | } 117 | &.today{ 118 | outline: 2px solid $--color-primary; 119 | z-index: 2; 120 | } 121 | } 122 | .info-date{ 123 | font-size: 18px; 124 | font-weight: bolder; 125 | } 126 | .info-festival{ 127 | margin-top: 3px; 128 | text-align: center; 129 | } 130 | .info-lunar{ 131 | position: absolute; 132 | bottom: 10px; 133 | right: 10px; 134 | } 135 | .info-term{ 136 | position: absolute; 137 | bottom: 10px; 138 | left: 10px; 139 | } 140 | 141 | } 142 | } 143 | } 144 | } -------------------------------------------------------------------------------- /src/components/index.vue: -------------------------------------------------------------------------------- 1 | 23 | 24 | -------------------------------------------------------------------------------- /src/components/item.vue: -------------------------------------------------------------------------------- 1 | 16 | 17 | -------------------------------------------------------------------------------- /src/components/main.js: -------------------------------------------------------------------------------- 1 | import Calendar from './index.vue' 2 | import '../assets/styles.scss'; 3 | 4 | Calendar.install = function (Vue) { 5 | Vue.component(Calendar.name, Calendar) 6 | } 7 | 8 | if (typeof window !== 'undefined' && window.Vue) { 9 | window.Calendar = Calendar; 10 | window.Vue.use(Calendar); 11 | } 12 | 13 | export default Calendar 14 | -------------------------------------------------------------------------------- /src/components/title-bar.vue: -------------------------------------------------------------------------------- 1 | 17 | 18 | -------------------------------------------------------------------------------- /src/main.js: -------------------------------------------------------------------------------- 1 | import Vue from 'vue' 2 | import App from './App.vue' 3 | 4 | Vue.config.productionTip = false 5 | 6 | new Vue({ 7 | render: h => h(App), 8 | }).$mount('#app') 9 | --------------------------------------------------------------------------------