index.js 1.2KB

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