1.分析
*上面月份是一部分
*下面的日期是一个整体

*根据获取到的数据先获取到有几个月
*再给每个月赋值
*月份切换时修改数据,在下面部分根据切换的数据使用v-if来实现切换
2.代码实现
canlender.vue
template:

script:
data中:


数据处理完成,把分组好的数组传到cell-month中:
cell-month.vue
template:

script:

主要的几个方法就是
1.要把月份抽取出来,然后去重,显示一共有几个月
2.在显示每个月的信息时,要根据穿过来的年月,判断这个月共有几天
3.判断每个月的1号是周几,然后再插到相应的周几之下
网友评论