日期时间的简单封装使用(包括农历)

386 阅读1分钟

1、引入将日期转换为农历的包,然后在页面上引入。npm install --save chinese-lunar-calendar image.png

2、写一个函数获取时间日期, image.png

3、然后将这个函数放在mounted中写一个定时器重复调用。(最后记得最好写一个销毁 beforedestroy) image.png

4、如果需要获取农历的时间日期,直接使用刚刚引入的包即可,如图所示。 image.png

5、最后贴上全部代码,方便copy。