1.日期格式化
安装插件,官网:Moment.js
npm install moment --save
示例:
//Sat Mar 14 2020 16:57:59 GMT+0800 (中国标准时间)
let date = new Date();
//2020-03-14 16:57:59
date = moment(date).format("YYYY-MM-DD HH:mm:ss");
2.引用JSON文件中的数据
import ChineCitys from '../../../static/ChineCitys.json'
console.log(ChineCitys)
![](https://img-blog.csdnimg.cn/20200314215147985.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1J1YW5CaWdTaHVhaQ==,size_16,color_FFFFFF,t_70)
![](https://img-blog.csdnimg.cn/20200314215329248.png?x-oss-process=image/watermark,type_ZmFuZ3poZW5naGVpdGk,shadow_10,text_aHR0cHM6Ly9ibG9nLmNzZG4ubmV0L1J1YW5CaWdTaHVhaQ==,size_16,color_FFFFFF,t_70)