index.js 1.4 KB

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