1 export default {
2 name: 'MarkShow',
3 filters: {
4 timefilters(val) {
5 if (val === null || val === '') {
6 return '暂无时间';
7 }
8 const d = new Date(val); // val 为表格内取到的后台时间
9 const month = d.getMonth() + 1 < 10 ? `0${d.getMonth() + 1}` : d.getMonth() + 1;
10 const day = d.getDate() < 10 ? `0${d.getDate()}` : d.getDate();
11 const hours = d.getHours() < 10 ? `0${d.getHours()}` : d.getHours();
12 const min = d.getMinutes() < 10 ? `0${d.getMinutes()}` : d.getMinutes();
13 const sec = d.getSeconds() < 10 ? `0${d.getSeconds()}` : d.getSeconds();
14 const times = `${d.getFullYear()}-${month}-${day} ${hours}:${min}:${sec}`;
15 return times;
16 },
17 },
18 data() {
19 return {
20 mark_show: [],
21 activeKey: ['0'],
22 };
23 },
<p>评分时间:<span class="mark_reason">{{ mark.comment_time | timefilters }}span>p>