1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465 |
- "use strict";
- const common_vendor = require("../../common/vendor.js");
- const _sfc_main = {
- data() {
- return {
- weeks: ["日", "一", "二", "三", "四", "五", "六"],
- calendarRows: this.getCalendarRows()
- };
- },
- methods: {
- getCalendarRows() {
- const d = /* @__PURE__ */ new Date();
- const year = d.getFullYear();
- const month = d.getMonth();
- const firstDay = new Date(year, month, 1).getDay();
- const days = new Date(year, month + 1, 0).getDate();
- const rows = [];
- let row = new Array(7).fill(0);
- let day = 1;
- for (let i = 0; i < 6; i++) {
- for (let j = 0; j < 7; j++) {
- if (i === 0 && j < firstDay)
- continue;
- if (day > days)
- break;
- row[j] = day++;
- }
- rows.push([...row]);
- row = new Array(7).fill(0);
- if (day > days)
- break;
- }
- return rows;
- },
- isToday(d) {
- const now = /* @__PURE__ */ new Date();
- return d === now.getDate();
- }
- }
- };
- function _sfc_render(_ctx, _cache, $props, $setup, $data, $options) {
- return {
- a: common_vendor.f($data.weeks, (w, k0, i0) => {
- return {
- a: common_vendor.t(w),
- b: w
- };
- }),
- b: common_vendor.f($data.calendarRows, (row, i, i0) => {
- return {
- a: common_vendor.f(row, (d, k1, i1) => {
- return {
- a: common_vendor.t(d > 0 ? d : ""),
- b: d,
- c: $options.isToday(d) ? 1 : ""
- };
- }),
- b: i
- };
- })
- };
- }
- const MiniProgramPage = /* @__PURE__ */ common_vendor._export_sfc(_sfc_main, [["render", _sfc_render], ["__scopeId", "data-v-3ceb4997"]]);
- wx.createPage(MiniProgramPage);
- //# sourceMappingURL=../../../.sourcemap/mp-weixin/pages/calendar/index.js.map
|