vue3.0 日历

效果图

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

安装

环境

“vue”: “^3.2.6” “vite”: “^2.5.4”

介绍

解决思路 利用css 缩放 来处理大屏适配的问题,
项目地址

安装

npm i calendar-vue3

引入

import {calendarVue} from 'calendar-vue3'
import 'calendar-vue3/dist/style.css'

使用示例

 <template>
<!-- tablecommon -->
 <el-scrollbar class="commonBoxmp white-bg ">
   <calendarVue style="height:720px"
   @handleScopeOf="handleScopeOf"
   @handleCurrent="handleCurrent"
   >
     <template #content="{index,data}">
     <div>
        <h4> {{dayjs(data.date).format("YYYY-MM-DD")}}   {{}}</h4>
     </div>
     </template>
   </calendarVue>
  </el-scrollbar>
  
</template>

<script setup lang="ts">
import {ref,reactive,onMounted} from 'vue';
import {useRouter,useRoute} from 'vue-router'
import calendarVue from '/@/components/calendar-vue3.vue'
// import {calendarVue} from 'calendar-vue3'
// import 'calendar-vue3/dist/style.css'//1.1.0-beta.10 版本
import dayjs from "dayjs";
const router = useRouter()
   const route = useRoute()
    onMounted(()=>{
    })
/*
基本数据类型
引用数据类型(复杂类型) 个人建议 ref初始化变量 
ref 和 reactive 本质我们可以简单的理解为ref是对reactive的二次包装, 
ref定义的数据访问的时候要多一个.value
*/
 const count =ref(0);
 const state = reactive({
 })
 const handleScopeOf = (e:any)=>{
  console.log('e :>> ', e.next());
  
}

const handleCurrent = (e:any)=>{
  console.log('e :>> ', e);
}

</script>

<style  scoped lang="scss" >

</style>

事件

事件名说明回调参数
handleCurrent左击日历或者右键选择添加日程才会触发index:当前点击的日历xi下表索引,date:当前日期
handleScopeOf右键选择添加日程范围选择才会触发1、startIndex:开始日历下表索引,endIndex:结束日历下表索引,startDate:开始时间,endDate:结束时间。2、next 函数 点击结束日期清空界面选择效果

插槽

content

   <calendarVue style="height:720px"
   @handleScopeOf="handleScopeOf"
   @handleCurrent="handleCurrent"
   >
     <template #content="{index,data}">
     <div>
        <h4> {{dayjs(data.date).format("YYYY-MM-DD")}}</h4>
     </div>
     </template>
   </calendarVue>

当前时间展示内容

参数说明类型
index当前日期下表索引值number
data.date当前日期Date
  • 1
    点赞
  • 5
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值