文山网站建设联系电话,如何查看一个网站的访问量,谷歌seo排名,国内阿里巴巴网站怎么做在不指定任何特殊配置的情况下#xff0c;返回的 date 类型的字段会自动转成 UTC 格式字符串#xff0c;形如 2022-08-11T10:50:31.05000:00。 前端如何处理#xff1f;
vue举例
utils 下新建 mixins.js文件
// minins.js文件
import Vue from vue;
import {…在不指定任何特殊配置的情况下返回的 date 类型的字段会自动转成 UTC 格式字符串形如 2022-08-11T10:50:31.05000:00。 前端如何处理
vue举例
utils 下新建 mixins.js文件
// minins.js文件
import Vue from vue;
import { Message } from element-ui;Vue.mixin({methods: {// 后端日期格式化rTime(date) {var json_date new Date(date).toJSON();return new Date(new Date(json_date) 8 * 3600 * 1000).toISOString().replace(/T/g, ).replace(/\.[\d]{3}Z/, );},},
});main.js中导入
import /utils/mixins.js;其他页面使用
template{{ rTime(Time) }}
/templatedata() {return {Time:2022-08-11T10:50:31.05000:00},};},这样页面显示的就是2022-08-11 10:50:31正常的时间了