index.js 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. 'use strict';
  2. var __spreadArray =
  3. (this && this.__spreadArray) ||
  4. function (to, from) {
  5. for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
  6. to[j] = from[i];
  7. return to;
  8. };
  9. Object.defineProperty(exports, '__esModule', { value: true });
  10. var component_1 = require('../../../common/component');
  11. component_1.VantComponent({
  12. props: {
  13. title: {
  14. type: String,
  15. value: '日期选择',
  16. },
  17. subtitle: String,
  18. showTitle: Boolean,
  19. showSubtitle: Boolean,
  20. firstDayOfWeek: {
  21. type: Number,
  22. observer: 'initWeekDay',
  23. },
  24. },
  25. data: {
  26. weekdays: [],
  27. },
  28. created: function () {
  29. this.initWeekDay();
  30. },
  31. methods: {
  32. initWeekDay: function () {
  33. var defaultWeeks = ['日', '一', '二', '三', '四', '五', '六'];
  34. var firstDayOfWeek = this.data.firstDayOfWeek || 0;
  35. this.setData({
  36. weekdays: __spreadArray(
  37. __spreadArray([], defaultWeeks.slice(firstDayOfWeek, 7)),
  38. defaultWeeks.slice(0, firstDayOfWeek)
  39. ),
  40. });
  41. },
  42. onClickSubtitle: function (event) {
  43. this.$emit('click-subtitle', event);
  44. },
  45. },
  46. });