fetch 异步请求
fetch(’/api/customer’)
.then(response => response.json())
.then(data => {
console.log(data)
});
请求mock数据
js 报错处理
function test(){try{ a + 1}catch(e){console.log(e.message)}}
js 时间转化为unix时间戳
js 时间转化为秒
dateTime = Date.now();
dateTime = new Date(‘2012-06-08 12:21:12’).getTime();
timestamp = Math.floor(dateTime / 1000);
1339129272