element-gui
Version:
A Component Library for Vue.js.
1,003 lines (914 loc) • 30.6 kB
JavaScript
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "/dist/";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 65);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return normalizeComponent; });
/* globals __VUE_SSR_CONTEXT__ */
// IMPORTANT: Do NOT use ES2015 features in this file (except for modules).
// This module is a runtime utility for cleaner component module output and will
// be included in the final webpack user bundle.
function normalizeComponent (
scriptExports,
render,
staticRenderFns,
functionalTemplate,
injectStyles,
scopeId,
moduleIdentifier, /* server only */
shadowMode /* vue-cli only */
) {
// Vue.extend constructor export interop
var options = typeof scriptExports === 'function'
? scriptExports.options
: scriptExports
// render functions
if (render) {
options.render = render
options.staticRenderFns = staticRenderFns
options._compiled = true
}
// functional template
if (functionalTemplate) {
options.functional = true
}
// scopedId
if (scopeId) {
options._scopeId = 'data-v-' + scopeId
}
var hook
if (moduleIdentifier) { // server build
hook = function (context) {
// 2.3 injection
context =
context || // cached call
(this.$vnode && this.$vnode.ssrContext) || // stateful
(this.parent && this.parent.$vnode && this.parent.$vnode.ssrContext) // functional
// 2.2 with runInNewContext: true
if (!context && typeof __VUE_SSR_CONTEXT__ !== 'undefined') {
context = __VUE_SSR_CONTEXT__
}
// inject component styles
if (injectStyles) {
injectStyles.call(this, context)
}
// register component module identifier for async chunk inferrence
if (context && context._registeredComponents) {
context._registeredComponents.add(moduleIdentifier)
}
}
// used by ssr in case component is cached and beforeCreate
// never gets called
options._ssrRegister = hook
} else if (injectStyles) {
hook = shadowMode
? function () { injectStyles.call(this, this.$root.$options.shadowRoot) }
: injectStyles
}
if (hook) {
if (options.functional) {
// for template-only hot-reload because in that case the render fn doesn't
// go through the normalizer
options._injectStyles = hook
// register for functioal component in vue file
var originalRender = options.render
options.render = function renderWithStyleInjection (h, context) {
hook.call(context)
return originalRender(h, context)
}
} else {
// inject component registration as beforeCreate hook
var existing = options.beforeCreate
options.beforeCreate = existing
? [].concat(existing, hook)
: [hook]
}
}
return {
exports: scriptExports,
options: options
}
}
/***/ }),
/***/ 43:
/***/ (function(module, exports) {
module.exports = require("element-gui/lib/utils/ChineseCalendar");
/***/ }),
/***/ 65:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
// CONCATENATED MODULE: ./node_modules/vue-loader/lib/loaders/templateLoader.js??vue-loader-options!./node_modules/vue-loader/lib??vue-loader-options!./packages/calendar-pro/src/Index.vue?vue&type=template&id=624935da&
var render = function() {
var _vm = this
var _h = _vm.$createElement
var _c = _vm._self._c || _h
return _c(
"div",
{
class: [{ showWeek: _vm.isWeek }, "el-calendar-pro"],
style: { width: _vm.width, height: _vm.height }
},
[
_vm.showTitle
? _c("title-bar", {
attrs: { year: _vm.renderYear, month: _vm.renderMonth }
})
: _vm._e(),
_c("div", { staticClass: "el-calendar-pro__body" }, [
_c(
"table",
{ attrs: { width: "100%", cellspacing: "0", cellpadding: "0" } },
[
_c("thead", [
_c(
"tr",
_vm._l(this.weekTitle, function(weekDay, i) {
return _c("th", { key: i }, [_vm._v(_vm._s(weekDay))])
}),
0
)
]),
_c(
"tbody",
_vm._l(_vm.weekCount, function(week, j) {
return _c(
"tr",
{ key: j, class: { "no-left-border": !_vm.border } },
_vm._l(7, function(day, m) {
return _c(
"td",
{ key: m },
[
_vm._t("dateCell", null, {
date: _vm.currentDate(week, day)
}),
_c(
"div",
{
on: {
click: function($event) {
_vm.dateClick(_vm.currentDate(week, day))
}
}
},
[
_c("Item", {
attrs: { source: _vm.currentDate(week, day) }
})
],
1
)
],
2
)
}),
0
)
}),
0
)
]
)
])
],
1
)
}
var staticRenderFns = []
render._withStripped = true
// CONCATENATED MODULE: ./packages/calendar-pro/src/Index.vue?vue&type=template&id=624935da&
// EXTERNAL MODULE: external "element-gui/lib/utils/ChineseCalendar"
var ChineseCalendar_ = __webpack_require__(43);
var ChineseCalendar_default = /*#__PURE__*/__webpack_require__.n(ChineseCalendar_);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/calendar-pro/src/Item.vue?vue&type=script&lang=js&
/* harmony default export */ var Itemvue_type_script_lang_js_ = ({
name: 'item',
props: {
source: Object
},
render: function render(h) {
var parent,
_$parent = this.$parent,
renderContent = _$parent.renderContent,
_renderProxy = _$parent._renderProxy;
return renderContent.call(_renderProxy, h, this.source);
}
});
// CONCATENATED MODULE: ./packages/calendar-pro/src/Item.vue?vue&type=script&lang=js&
/* harmony default export */ var src_Itemvue_type_script_lang_js_ = (Itemvue_type_script_lang_js_);
// EXTERNAL MODULE: ./node_modules/vue-loader/lib/runtime/componentNormalizer.js
var componentNormalizer = __webpack_require__(0);
// CONCATENATED MODULE: ./packages/calendar-pro/src/Item.vue
var Item_render, Item_staticRenderFns
/* normalize component */
var component = Object(componentNormalizer["a" /* default */])(
src_Itemvue_type_script_lang_js_,
Item_render,
Item_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var api; }
component.options.__file = "packages/calendar-pro/src/Item.vue"
/* harmony default export */ var Item = (component.exports);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/calendar-pro/src/TitleBar.vue?vue&type=script&lang=js&
/* harmony default export */ var TitleBarvue_type_script_lang_js_ = ({
name: 'TitleBar',
props: {
year: [Number, String],
month: [Number, String]
},
render: function render(h) {
var parent,
_$parent = this.$parent,
renderTitle = _$parent.renderTitle,
_renderProxy = _$parent._renderProxy;
return renderTitle.call(_renderProxy, h, this.year, this.month);
}
});
// CONCATENATED MODULE: ./packages/calendar-pro/src/TitleBar.vue?vue&type=script&lang=js&
/* harmony default export */ var src_TitleBarvue_type_script_lang_js_ = (TitleBarvue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/calendar-pro/src/TitleBar.vue
var TitleBar_render, TitleBar_staticRenderFns
/* normalize component */
var TitleBar_component = Object(componentNormalizer["a" /* default */])(
src_TitleBarvue_type_script_lang_js_,
TitleBar_render,
TitleBar_staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var TitleBar_api; }
TitleBar_component.options.__file = "packages/calendar-pro/src/TitleBar.vue"
/* harmony default export */ var TitleBar = (TitleBar_component.exports);
// CONCATENATED MODULE: ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib??vue-loader-options!./packages/calendar-pro/src/Index.vue?vue&type=script&lang=js&
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
/* harmony default export */ var Indexvue_type_script_lang_js_ = ({
name: 'ElCalendarPro',
components: { Item: Item, TitleBar: TitleBar },
props: {
width: {
type: String,
default: '100%'
},
height: {
type: String,
default: '100%'
},
defaultDate: {
type: [Date, String],
default: function _default() {
return new Date();
}
},
selectDate: {
type: Array,
default: function _default() {
return [];
}
},
disabledDate: {
type: Array,
default: function _default() {
return [];
}
},
maxDate: {
type: [Date, String]
},
minDate: {
type: [Date, String]
},
highlighterDate: {
type: Array,
default: function _default() {
return [];
}
},
// 高亮周末
isWeek: {
type: Boolean,
default: true
},
// 是否显示头部标题栏(年月日/按钮)
showTitle: {
type: Boolean,
default: true
},
// 是否显示控制按钮
showControlBtn: {
type: Boolean,
default: true
},
renderTitle: {
type: Function,
default: function _default(h, year, month) {
var _this = this;
return h(
'div',
{ 'class': 'el-calendar-pro__title' },
[h(
'div',
{ 'class': 'el-calendar-pro__title-info' },
[h(
'span',
{ 'class': 'el-calendar-pro__year' },
[year, '\u5E74']
), h(
'span',
{ 'class': 'el-calendar-pro__month' },
[month, '\u6708']
)]
), this.showControlBtn ? h(
'div',
{ 'class': 'el-calendar-pro__tool' },
[h('el-button-group', [h(
'el-button',
{
on: {
'click': function click() {
return _this.turn(-12);
}
}
},
[h('i', { 'class': 'el-icon-d-arrow-left' }), '\u4E0A\u4E00\u5E74']
), h(
'el-button',
{
on: {
'click': function click() {
return _this.turn(-1);
}
}
},
[h('i', { 'class': 'el-icon-arrow-left' }), '\u4E0A\u4E00\u6708']
), h(
'el-button',
{
on: {
'click': function click() {
return _this.turnNow();
}
}
},
['\u672C\u6708']
), h(
'el-button',
{
on: {
'click': function click() {
return _this.turn(1);
}
}
},
['\u4E0B\u4E00\u6708', h('i', { 'class': 'el-icon-arrow-right el-icon--right' })]
), h(
'el-button',
{
on: {
'click': function click() {
return _this.turn(12);
}
}
},
['\u4E0B\u4E00\u5E74', h('i', { 'class': 'el-icon-d-arrow-right el-icon--right' })]
)])]
) : null]
);
}
},
// 是否渲染农历
showLunar: {
type: Boolean,
default: true
},
// 是否渲染节日
showFestival: {
type: Boolean,
default: true
},
// 是否渲染节气
showTerm: {
type: Boolean,
default: true
},
weekTitleAlign: {
type: String,
default: 'right'
},
weekCount: {
type: Number,
default: 6
},
border: {
type: Boolean,
default: true
},
multiple: {
type: Boolean,
default: false
},
firstDayOfWeek: {
type: Number,
default: 7
},
renderContent: {
type: Function,
default: function _default(h, data) {
var isToday = data.isToday,
isSelect = data.isSelect,
isHighlighter = data.isHighlighter,
isDisabled = data.isDisabled,
isWeekend = data.isWeekend,
isOtherMonthDay = data.isOtherMonthDay,
date = data.date,
year = data.year,
month = data.month,
day = data.day,
weekDay = data.weekDay,
lunar = data.lunar,
festival = data.festival,
term = data.term,
renderMonth = data.renderMonth;
// 是否是初一
var isChuYi = lunar.lunarDay == 1;
var boxClassName = 'day-box\n ' + (isSelect ? 'select' : '') + '\n ' + (isDisabled ? 'disabled' : '') + '\n ' + (isHighlighter ? 'highlighter' : '') + '\n ' + (isToday ? 'today' : '') + '\n ' + (isWeekend ? 'weekend' : '') + '\n ' + (isOtherMonthDay ? 'other-month-day' : '') + ' ';
var lunarClassName = 'info-lunar ' + (isChuYi ? 'lunar-first' : '');
// 农历字符串
var lunarStr = isChuYi ? lunar.lunarMonthChiness + lunar.lunarDayChiness : lunar.lunarDayChiness;
// 节日、节气
var $festival = festival ? h(
'div',
{ 'class': 'info-festival' },
[festival]
) : null;
var $term = term ? h(
'div',
{ 'class': 'info-term' },
[term]
) : null;
var $date = h('span', [day]);
return h(
'div',
{ 'class': boxClassName },
[h(
'div',
{ 'class': 'info-date' },
[$date]
), this.showFestival ? $festival : null, this.showLunar ? h(
'div',
{ 'class': lunarClassName },
[lunarStr]
) : null, this.showTerm ? $term : null]
);
}
},
beforeRender: Function
},
created: function created() {
this.render(this.renderYear, this.renderMonth);
},
data: function data() {
var date = new Date(this.defaultDate);
return {
renderYear: date.getFullYear(),
renderMonth: date.getMonth() + 1,
currentMonthDays: [],
weekTitle: []
};
},
methods: {
dateClick: function dateClick(date) {
// 判断不可点击
if (!date.isDisabled) {
this.$emit('date-click', date);
var tempDate = this.formatDate(date.date);
var index = this.selectDate.indexOf(tempDate);
if (this.multiple) {
if (index > -1) {
this.selectDate.splice(index, 1);
} else {
this.selectDate.push(tempDate);
}
date.isSelect = !date.isSelect;
} else {
this.selectDate.length = 0;
this.selectDate.push(tempDate);
date.isSelect = true;
// 强制render
this.render(date.year, date.month, this.weekCount);
}
}
},
/**
* 获取当前渲染的月份
* @returns {{year: number | *, month: methods.renderMonth, days: methods.renderMonth}}
*/
getRenderedMonth: function getRenderedMonth() {
return {
year: this.renderYear,
month: this.renderMonth,
days: this.currentMonthDays
};
},
/**
* 强制渲染某个月份
* @param year
* @param month
*/
renderThisMonth: function renderThisMonth(year, month) {
this.render(year, month);
},
/**
* 渲染
* @param year
* @param month
* @param weekCount
*/
render: function render(year, month) {
var _this2 = this;
var weekCount = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : this.weekCount;
var result = this.monthDetail(year, month, weekCount);
var beforeRender = this.beforeRender;
// 重新绑定数据->渲染
var setInfo = function setInfo() {
_this2.currentMonthDays = result;
_this2.renderYear = year;
_this2.renderMonth = month;
};
// 如果有beforeRender回调
if (beforeRender && typeof beforeRender === 'function') {
beforeRender(year, month, setInfo);
} else {
setInfo();
};
},
// 日期格式化yyyy-mm-dd
formatDate: function formatDate(date) {
var year = date.getFullYear();
var month = date.getMonth() + 1;
var day = date.getDate();
if (month < 10) {
month = '0' + month;
}
if (day < 10) {
day = '0' + day;
}
return year + '-' + month + '-' + day;
},
// 日期转时间戳
dateToTime: function dateToTime(date) {
var timestamp = new Date(date).getTime();
return timestamp;
},
/**
* 计算该月需要渲染的日期信息
* @param year
* @param month
* @param weekCount
* @returns {Array}
*/
monthDetail: function monthDetail(year, month, weekCount) {
// 计算用的month为传入month - 1
var monthToUse = month - 1;
// 构建该月第一天date对象
var firstDate = new Date(year, monthToUse);
// 获取周几信息,0表示周日
var weekDay = firstDate.getDay();
// console.log("weekDay", weekDay);
// firstDayOfWeek设置每周起始日,默认周日0
// 将date设置为该周的第一天
switch (this.firstDayOfWeek) {
case 7:
this.weekTitle = ['日', '一', '二', '三', '四', '五', '六'];
firstDate.setDate(1 - weekDay);
break;
case 1:
this.weekTitle = ['一', '二', '三', '四', '五', '六', '日'];
if (weekDay != 0) {
firstDate.setDate(2 - weekDay);
} else {
firstDate.setDate(weekDay - 5);
};
break;
case 2:
this.weekTitle = ['二', '三', '四', '五', '六', '日', '一'];
if (weekDay == 1) {
firstDate.setDate(weekDay - 6);
} else if (weekDay != 0) {
firstDate.setDate(3 - weekDay);
} else {
firstDate.setDate(weekDay - 4);
};
break;
case 3:
this.weekTitle = ['三', '四', '五', '六', '日', '一', '二'];
if (weekDay == 1) {
firstDate.setDate(weekDay - 5);
} else if (weekDay == 2) {
firstDate.setDate(weekDay - 7);
} else if (weekDay != 0) {
firstDate.setDate(4 - weekDay);
} else {
firstDate.setDate(weekDay - 3);
};
break;
case 4:
this.weekTitle = ['四', '五', '六', '日', '一', '二', '三'];
if (weekDay == 3) {
firstDate.setDate(weekDay - 8);
} else if (weekDay == 1) {
firstDate.setDate(weekDay - 4);
} else if (weekDay == 2) {
firstDate.setDate(weekDay - 6);
} else if (weekDay != 0) {
firstDate.setDate(5 - weekDay);
} else {
firstDate.setDate(weekDay - 2);
};
break;
case 5:
this.weekTitle = ['五', '六', '日', '一', '二', '三', '四'];
if (weekDay == 3) {
firstDate.setDate(weekDay - 7);
} else if (weekDay == 1) {
firstDate.setDate(weekDay - 3);
} else if (weekDay == 2) {
firstDate.setDate(weekDay - 5);
} else if (weekDay != 0) {
firstDate.setDate(6 - weekDay);
} else {
firstDate.setDate(weekDay - 1);
};
break;
case 6:
this.weekTitle = ['六', '日', '一', '二', '三', '四', '五'];
if (weekDay == 0) {
firstDate.setDate(weekDay);
} else if (weekDay == 1) {
firstDate.setDate(weekDay - 2);
} else if (weekDay == 2) {
firstDate.setDate(weekDay - 4);
} else if (weekDay == 3) {
firstDate.setDate(weekDay - 6);
} else if (weekDay == 4) {
firstDate.setDate(weekDay - 8);
} else if (weekDay == 5) {
firstDate.setDate(weekDay - 10);
} else {
firstDate.setDate(weekDay - 5);
};
break;
};
// 该月要显示的所有日期对象数组,包括前后月补完
var monthDays = [];
var todayDate = new Date();
for (var i = 0, cursor = firstDate; i < weekCount * 7; i++) {
// console.log("cursor",cursor)
var day = cursor.getDate();
var thisDate = new Date(cursor);
// console.log("thisDate", thisDate);
var isToday = todayDate.getFullYear() == thisDate.getFullYear() && todayDate.getMonth() == thisDate.getMonth() && todayDate.getDate() == thisDate.getDate();
// var dateStr = `${year}-${this.twoDigit(month)}-${this.twoDigit(day)}`
// let isSelect = this.selectDate.indexOf(dateStr);
// let tempDate = thisDate.getFullYear()+"-"+this.twoDigit(thisDate.getMonth()+1)+"-"+this.twoDigit(thisDate.getDate());
var tempDate = this.formatDate(thisDate);
var isSelect = this.selectDate.indexOf(tempDate) >= 0 || false;
var isHighlighter = this.highlighterDate.indexOf(tempDate) >= 0 || false;
var isDisabled;
if (this.maxDate && this.minDate && this.disabledDate) {
isDisabled = this.dateToTime(thisDate) >= this.dateToTime(this.maxDate) || this.dateToTime(thisDate) <= this.dateToTime(this.minDate) - 86400000 || this.disabledDate.indexOf(tempDate) >= 0;
} else if (this.maxDate && this.disabledDate) {
isDisabled = this.dateToTime(thisDate) >= this.dateToTime(this.maxDate) || this.disabledDate.indexOf(tempDate) >= 0;
} else if (this.minDate && this.disabledDate) {
isDisabled = this.dateToTime(thisDate) <= this.dateToTime(this.minDate) - 86400000 || this.disabledDate.indexOf(tempDate) >= 0;
} else if (this.disabledDate) {
isDisabled = this.disabledDate.indexOf(tempDate) >= 0;
} else {
isDisabled = false;
};
// console.log("isSelect",isSelect)
var defaultDate = new Date(this.defaultDate);
var isDefaultDate = defaultDate.getFullYear() == defaultDate.getFullYear() && defaultDate.getMonth() == defaultDate.getMonth() && defaultDate.getDate() == defaultDate.getDate();
monthDays.push({
// 当前日期信息
date: thisDate,
year: thisDate.getFullYear(),
month: thisDate.getMonth() + 1,
day: thisDate.getDate(),
weekDay: thisDate.getDay(),
lunar: ChineseCalendar_default.a.date2lunar(thisDate), // 农历
festival: ChineseCalendar_default.a.lunarFestival(thisDate), // 节日
term: ChineseCalendar_default.a.lunarTerm(thisDate), // 节气
// a:ChineseCalendar.getTerm(thisDate.getFullYear(),(thisDate.getMonth())*2 -1), // 节气
isToday: isToday,
// 是否是默认的那天
isDefaultDate: isDefaultDate,
// 是否是周末
isWeekend: thisDate.getDay() == 0 || thisDate.getDay() == 6,
isSelect: isSelect,
isHighlighter: isHighlighter,
isDisabled: isDisabled,
// 是否是当前渲染月份中的日子
isOtherMonthDay: thisDate.getMonth() + 1 != month,
// 当前面板渲染的年、月
renderYear: year,
renderMonth: month
});
cursor.setDate(day + 1);
}
// console.log("monthDays", monthDays);
return monthDays;
},
/**
* 从当前渲染的月份中根据第几周,第几天获取日期数据
* @param week
* @param day
* @returns {*}
*/
currentDate: function currentDate(week, day) {
var index = (week - 1) * 7 + day - 1;
return this.currentMonthDays[index];
},
/**
* 向后跳转几月,负数则是向前
* @param step
*/
turn: function turn(step) {
var year = this.renderYear,
month = this.renderMonth - 1;
var date = new Date(year, month);
date.setMonth(date.getMonth() + step);
// 获取要渲染的年份、月份
var toRenderYear = date.getFullYear();
var toRenderMonth = date.getMonth() + 1;
// 渲染
this.render(toRenderYear, toRenderMonth);
},
/**
* 跳转到当前月
*/
turnNow: function turnNow() {
var date = new Date();
// 获取要渲染的年份、月份
var toRenderYear = date.getFullYear();
var toRenderMonth = date.getMonth() + 1;
// 渲染
this.render(toRenderYear, toRenderMonth);
}
},
watch: {
renderYear: function renderYear(year, oldYear) {
this.$emit('year-change', year, this.renderMonth);
},
renderMonth: function renderMonth(month, oldMonth) {
this.$emit('month-change', this.renderYear, month);
},
defaultDate: function defaultDate(date) {
var day = new Date(date);
var year = day.getFullYear();
var month = day.getMonth() + 1;
this.render(year, month);
}
}
});
// CONCATENATED MODULE: ./packages/calendar-pro/src/Index.vue?vue&type=script&lang=js&
/* harmony default export */ var src_Indexvue_type_script_lang_js_ = (Indexvue_type_script_lang_js_);
// CONCATENATED MODULE: ./packages/calendar-pro/src/Index.vue
/* normalize component */
var Index_component = Object(componentNormalizer["a" /* default */])(
src_Indexvue_type_script_lang_js_,
render,
staticRenderFns,
false,
null,
null,
null
)
/* hot reload */
if (false) { var Index_api; }
Index_component.options.__file = "packages/calendar-pro/src/Index.vue"
/* harmony default export */ var Index = (Index_component.exports);
// CONCATENATED MODULE: ./packages/calendar-pro/index.js
/* istanbul ignore next */
Index.install = function (Vue) {
Vue.component(Index.name, Index);
};
/* harmony default export */ var calendar_pro = __webpack_exports__["default"] = (Index);
/***/ })
/******/ });