<template>
<view class="calendar-wrapper">
<view class="header" v-if="headerBar">
<view class="preWidth" @click="changeMonth('pre')">
<view class="pre" ></view>
</view>
<view>{
{y+'年'+formatNum(m)+'月'}}</view>
<view class="nextWidth" @click="changeMonth('next')">
<view class="next" ></view>
</view>
</view>
<view class="week">
<view class="week-day" v-for="(item, index) in weekDay" :key="index">{
{ item }}</view>
</view>
<view :class="{ hide: !monthOpen }" class="content" :style="{ height: height }">
<view :style="{ top: positionTop + 'rpx' }" class="days">
<view class="item" v-for="(item, index) in dates" :key="index">
<view
class="day"
@click="selectOne(item, $event)"
:class="{
choose: choose == `${item.year}-${item.month}-${item.date}`&&item.isCurM,
nolm: !item.isCurM,
today: isToday(item.year, item.month, item.date),
isWorkDay: isWorkDay(item.year, item.month, item.date)
}">
{
{ Number(item.date) }}
</view>
<view class="markDay" v-if="isMarkDay(item.year, item.month, item.date)&&item.isCurM"></view>
<!-- <view class="today-text" v-if="isToday(item.year, item.month, item.date)">今</view> -->
</view>
</view>
</view>
<view class="weektoggle" @click="toggle">
<image src="../../static/indexImg/icon_rili_jiantou@2x.png" mode="scaleToFill" v-if="collapsible"></image>
</view>
</view>
</template>
<script>
export default {
name: 'ren-calendar',
props: {
// 星期几为第一天(0为星期日)
weekstart: {
type: Number,
default: 0
},
// 标记的日期
markDays: {
type: Array,
default: ()=>{
return [];
}
},
// 是否展开
open: {
type: Boolean,
default: true
},
//是否可收缩
collapsible:{
type: Boolean,
default: true
},
uniapp日历
最新推荐文章于 2025-03-02 13:21:20 发布