十年河东,十年河西,莫欺少年穷

学无止境,精益求精

详情参考文档:​​https://dayjs.fenxianglu.cn/category/manipulate.html#%E5%8A%A0%E4%B8%8A​

第一步:


npm install dayjs --save


第二步,点击小程序工具,Npm构造器

微信小程序 引入DayJS 用于时间处理_html


然后,我们就可以用DayJS 了

我在组件的【onLoad】方法中测试了下


lifetimes: {       attached: function () {       // 在组件实例进入页面节点树时执行       this.GetData();       var s = dayjs().format();       console.log(s);     }   },


微信小程序 引入DayJS 用于时间处理_构造器_02