全局配置 moment.js(vue2中使用)

Moment.js  JavaScript 日期处理类库

时间格式处理绕不过的一个库   http://momentjs.cn/

1、下载:(npm下载) npm install moment  

2、查看:下载完成后在项目最外层的 package.json 内

             

 

3、引入:项目的main.js文件内引入并挂在全局

      

 

4、使用:

    代码内部

    

    页面控制台内

    

 可以看到,搜索的 $moment 有8个,mounted 内 console 出来了刚好8个,没有在其他地方引入

更多使用方法  ->  http://momentjs.cn/docs/#/manipulating/

 

posted @ 2022-06-27 17:50  伊人兮明眸秋水  阅读(1645)  评论(0编辑  收藏  举报