[{"createTime":1735734952000,"id":1,"img":"hwy_ms_500_252.jpeg","link":"https://activity.huaweicloud.com/cps.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=V1g3MDY4NTY=&utm_medium=cps&utm_campaign=201905","name":"华为云秒杀","status":9,"txt":"华为云38元秒杀","type":1,"updateTime":1735747411000,"userId":3},{"createTime":1736173885000,"id":2,"img":"txy_480_300.png","link":"https://cloud.tencent.com/act/cps/redirect?redirect=1077&cps_key=edb15096bfff75effaaa8c8bb66138bd&from=console","name":"腾讯云秒杀","status":9,"txt":"腾讯云限量秒杀","type":1,"updateTime":1736173885000,"userId":3},{"createTime":1736177492000,"id":3,"img":"aly_251_140.png","link":"https://www.aliyun.com/minisite/goods?userCode=pwp8kmv3","memo":"","name":"阿里云","status":9,"txt":"阿里云2折起","type":1,"updateTime":1736177492000,"userId":3},{"createTime":1735660800000,"id":4,"img":"vultr_560_300.png","link":"https://www.vultr.com/?ref=9603742-8H","name":"Vultr","status":9,"txt":"Vultr送$100","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":5,"img":"jdy_663_320.jpg","link":"https://3.cn/2ay1-e5t","name":"京东云","status":9,"txt":"京东云特惠专区","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":6,"img":"new_ads.png","link":"https://www.iodraw.com/ads","name":"发布广告","status":9,"txt":"发布广告","type":1,"updateTime":1735660800000,"userId":3},{"createTime":1735660800000,"id":7,"img":"yun_910_50.png","link":"https://activity.huaweicloud.com/discount_area_v5/index.html?fromacct=261f35b6-af54-4511-a2ca-910fa15905d1&utm_source=aXhpYW95YW5nOA===&utm_medium=cps&utm_campaign=201905","name":"底部","status":9,"txt":"高性能云服务器2折起","type":2,"updateTime":1735660800000,"userId":3}]
所要实现的功能
1,这里使用的是element是选择月份的代码
2,后台返回的时间区间,意思就是说时间区间内2018年10月份到2019年4月份的月份是可以选择的,10月之前的日期和4月之后的日期都是不可以选择的。
3,在methods中写入方法
4,这里在定义starDate 和 endDate需要注意的坑,如果在data中直接定义的话可能会报错。 starDate is not
defined,这里出现这个原因可能是全局和局部的问题吧,具体什么原因还是请大神指点。
5,解决办法将它定义在数据外
6,日期的禁用,根据element的官方文档来写
7,关于这里开始日期减去8.64e7的问题,我这里仍然存在疑问,所以请知道的大神能够替我解答,或者说我这里是否存在什么问题,还请指点一二。
因为我们的要求是开始的月份也是可以被选择的,但是只给月份,默认日期是这个月的最后一天,所以不减去8.64e7,我这里的开始日期十月是被禁掉的。减去就可以了。
8,基本就是这样了,这个功能对于我这个菜鸟来说写了很长那个时间。也请教了很多的人。所以在这里记录下来,如果刚好对你有帮助那最好了。