The format displayed now is as shown in the figure below:
I expect a unified format, so I might as well handle it at the front end. The core code is as follows
filters: {
// 时间戳处理
formatDate: function(value, spe = '/') {
value = value * 1000
let data = new Date(value);
let year = data.getFullYear();
let month = data.getMonth() + 1;
let day = data.getDate();
let h = data.getHours();
let mm = data.getMinutes();
let s = data.getSeconds();
month = month >= 10 ? month : "0" + month;
day = day >= 10 ? day : "0" + day;
h = h >= 10 ? h : "0" + h;
mm = mm >= 10 ? mm : "0" + mm;
s = s >= 10 ? s : "0" + s;
return `${
year}${
spe}${
month}${
spe}${
day} ${
h}:${
mm}:${
s}`;
}
},
The method of use is as follows:
<text>{
{
item.create_time | formatDate('-')}}</text>
The code structure is as follows: