当前位置: 首页 > article >正文

uniapp自定义日历计划写法(vue2)

文章目录

  • uniapp自定义日历计划写法(vue2)
    • 1、效果
    • 2、实现源码

  • 前言:我们有时候需要实现的日历找不到相应的插件的时候,往往需要手动去写一个日历,以下就是我遇到这样的问题时,手搓出来的一个解决方案,希望可以帮助到更多的人。创作不易,请多多支持

uniapp自定义日历计划写法(vue2)

1、效果

在这里插入图片描述
在这里插入图片描述

2、实现源码

  • 创建calendar组件
<template><!-- 左右滑动切换月份 --><view @touchstart="handleTouchStart" @touchend="handleTouchEnd"><!--  <view class="titleBox"><view class="title">{{ currentYear }}.{{ currentMonth }}</view></view> --><view class="calendarDiv"><view class="cpc_week"><view class="week_day" v-for="(item,index) in week" :key="index">{{ item }}</view></view><view class="calendar_box"><viewclass="calendar_day" v-for="(item, index) in currentMonthAllDate" :key="index" @tap="selectedDate(item.date)"><view :class="[item.month == 'current' ? 'current_day':'']" class="calendar_day_number_div"><view class="day_number" :class="[(item.month == 'current' && currentToday == item.date) ? 'currentToday':'']">{{item.number}}</view></view><view class="date_plan" v-if="item.isPlan != null && item.isPlan"><view class="cpc_point" v-for="(item_plan,plan_index) in item.planTypes" :index="plan_index" :class="[(item_plan === 1 ? 'plan1':''),(item_plan === 2 ?'plan2':''),(item_plan === 3 ?'plan3':''),(item_plan === 4 ?'plan4':'')]"></view></view></view><view class="showBorderParent"><view class="showBorder" @tap="changeShowWeekOrMonth"></view></view></view></view></view></template><script>
export default {name: 'Calendar'
http://www.lryc.cn/news/2379189.html

相关文章:

  • Java IO框架
  • 数据库2——查询
  • Mamba LLM 架构简介:机器学习的新范式
  • Android 性能优化入门(一)—— 数据结构优化
  • 数据库中的锁机制
  • 【网络入侵检测】基于Suricata源码分析运行模式(Runmode)
  • AI日报 - 2025年05月19日
  • Spring源码主线全链路拆解:从启动到关闭的完整生命周期
  • Linux常用命令(十四)
  • 规则联动引擎GoRules初探
  • 基于OpenCV中的图像拼接方法详解
  • AI大模型学习二十六、使用 Dify + awesome-digital-human-live2d + ollama + ChatTTS打造数字人
  • HTML-3.2 表格的跨行跨列(课表制作实例)
  • Spring Cloud Sentinel 快速入门与生产实践指南
  • 系统架构设计(十):结构化编程
  • 标准差和方差是什么
  • 【周输入】510周阅读推荐-3
  • Android平台GB28181设备接入与功能支持详解
  • mvc-ioc实现
  • Windows 11 C:\Windows\Web\Wallpaper
  • 医疗信息系统安全防护体系的深度构建与理论实践融合
  • Compose笔记(二十五)--Brush
  • Spring Web MVC————入门(3)
  • HTML 属性详解
  • NC61 两数之和【牛客网】
  • Java生成可控的Word表格功能开发
  • Node.js中的洋葱模型
  • Spring Boot 中 MyBatis 与 Spring Data JPA 的对比介绍
  • 如何分析动态采样引起的计划不稳定 | OceanBase SQL 调优实践
  • 如何实现RTSP和RTMP低至100-200ms的延迟:直播SDK的技术突破