vue 简单筛选
作者:
my木子 | 来源:发表于
2019-08-13 10:48 被阅读0次//1. 简单页面展示用
<template>
<!-- time为时间戳 -->
<div>{{time | formatDate}}</div>
</template>
export default {
data() {
return {
time: 1516703495241
};
},
filters: {
formatDate: function (value) {
let date = new Date(value);
let y = date.getFullYear();
let MM = date.getMonth() + 1;
MM = MM < 10 ? ('0' + MM) : MM;
let d = date.getDate();
d = d < 10 ? ('0' + d) : d;
let h = date.getHours();
h = h < 10 ? ('0' + h) : h;
let m = date.getMinutes();
m = m < 10 ? ('0' + m) : m;
let s = date.getSeconds();
s = s < 10 ? ('0' + s) : s;
return y + '-' + MM + '-' + d + ' ' + h + ':' + m + ':' + s;
}
}
}
本文标题:vue 简单筛选
本文链接:https://www.haomeiwen.com/subject/fjkvjctx.html
网友评论