123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- <template>
- <uni-shadow-root class="weapp-lib-calendar-components-header-index"><view class="van-calendar__header">
- <block v-if="showTitle">
- <view class="van-calendar__header-title"><slot name="title"></slot></view>
- <view class="van-calendar__header-title">{{ title }}</view>
- </block>
- <view v-if="showSubtitle" class="van-calendar__header-subtitle" @click="onClickSubtitle">
- {{ subtitle }}
- </view>
- <view class="van-calendar__weekdays">
- <view v-for="(item,index) in (weekdays)" :key="item.index" class="van-calendar__weekday">
- {{ item }}
- </view>
- </view>
- </view></uni-shadow-root>
- </template>
- <script>
- global['__wxRoute'] = 'weapp/lib/calendar/components/header/index'
- "use strict";
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
- if (ar || !(i in from)) {
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
- ar[i] = from[i];
- }
- }
- return to.concat(ar || Array.prototype.slice.call(from));
- };
- Object.defineProperty(exports, "__esModule", { value: true });
- var component_1 = require("../../../common/component");
- (0, component_1.VantComponent)({
- props: {
- title: {
- type: String,
- value: '日期选择',
- },
- subtitle: String,
- showTitle: Boolean,
- showSubtitle: Boolean,
- firstDayOfWeek: {
- type: Number,
- observer: 'initWeekDay',
- },
- },
- data: {
- weekdays: [],
- },
- created: function () {
- this.initWeekDay();
- },
- methods: {
- initWeekDay: function () {
- var defaultWeeks = ['日', '一', '二', '三', '四', '五', '六'];
- var firstDayOfWeek = this.data.firstDayOfWeek || 0;
- this.setData({
- weekdays: __spreadArray(__spreadArray([], defaultWeeks.slice(firstDayOfWeek, 7), true), defaultWeeks.slice(0, firstDayOfWeek), true),
- });
- },
- onClickSubtitle: function (event) {
- this.$emit('click-subtitle', event);
- },
- },
- });
- export default global['__wxComponents']['weapp/lib/calendar/components/header/index']
- </script>
- <style platform="mp-weixin">
- @import '../../../common/index.css';.van-calendar__header{box-shadow:var(--calendar-header-box-shadow,0 2px 10px hsla(220,1%,50%,.16));flex-shrink:0}.van-calendar__header-subtitle,.van-calendar__header-title{font-weight:var(--font-weight-bold,500);height:var(--calendar-header-title-height,44px);line-height:var(--calendar-header-title-height,44px);text-align:center}.van-calendar__header-title+.van-calendar__header-title,.van-calendar__header-title:empty{display:none}.van-calendar__header-title:empty+.van-calendar__header-title{display:block!important}.van-calendar__weekdays{display:flex}.van-calendar__weekday{flex:1;font-size:var(--calendar-weekdays-font-size,12px);line-height:var(--calendar-weekdays-height,30px);text-align:center}
- </style>
|