uniapp ,vue,js日历卡片可滑动日期可点击选择可更改颜色样式

效果图

日期可左右滑动无限制,当天日期纯绿色填充标识样式,点击其他日期绿色边框标识(日期颜色可在样式里面更改$am-color)

1.创建一个.vue文件

<template>
	<view :class="[fold&&'flex flex-items-center', 'wx-card mt20']">
		<view :class="[!fold&&'f32 flex flex-center pb20',fold&&'card-header']" @click="initDate">
			<view :class="[fold&&'f26 tc']">{
  {nowDay.year}}年</view>
			<view :class="[fold&&'flex flex-center flex-items-end']">
				<text :class="[fold&&'f70']">{
  {nowDay.month}}</text>
				<text :class="[fold&&'f30','pb10 ml5']">月</text>
			</view>
		</view>
		<view v-if="verticaled" class="flex flex-items-center flex-around pb10">
			<view :class="['tc w7']" v-for="item in weeks" :key="item">
				{
  {item}}
			</view>
		</view>
		<view class="flex-1 fit-height">
			<swiper 
			:current="tabIndex" 
			:animation="animationData" 
			:class="[fold?'swiper-week':'swiper-month','flex-1']" 
			:vertical="verticaled"
			:duration="duration" 
			@change="ontabchange" 
			@animationfinish="animationfinish" >
				<swiper-item v-for="(days,index1) in list" :key="index1">
					<template v-if="fold">
						<view class="month-wrap flex flex-items-center flex-around pt5">
							<view :class="['tc',!(item.isNow||item.isFuture)&&'graya']" v-for="item in days.weeks" :key="item.day" @click="clickTime(item)">
								<view>{
  {item.week}}</view>
								<view :class="[item.isNow&&'active',item.isActive&&'active','mt20 pb20',!item.isAct&&item.isAM&&'isAM',!item.isAct&&item.isPM&&'isPM',item.isAct&&'isAct']">
									<text :class="[item.isNow&&'isNowWap',item.isActive&&'isSelect']">{
  {item.day}}</text>
								</view>
							</view>
						</view>
					</template>
					<template v-else>
						<view class="month-wrap">
							<view v-if="!verticaled" class="flex flex-items-center flex-around">
								<view :class="['tc w7']" v-for="item in weeks" :key="item">
									{
  {item}}
								</view>
							</view>
							<view class="flex flex-items-center flex-wrap">
								<view :class="['tc w7'
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值