Skip to content

Commit 658abf6

Browse files
committed
refine: add parseTime timestamp demo
1 parent 4940dd4 commit 658abf6

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/views/excel/index.vue

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
<el-table-column align="center" prop="created_at" label="发布时间" width="220">
2626
<template scope="scope">
2727
<i class="el-icon-time"></i>
28-
<span>{{scope.row.display_time}}</span>
28+
<span>{{scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}')}}</span>
2929
</template>
3030
</el-table-column>
3131
</el-table>
@@ -34,6 +34,7 @@
3434

3535
<script>
3636
import { fetchList } from '@/api/article'
37+
import { parseTime } from 'utils'
3738
3839
export default {
3940
data() {
@@ -67,7 +68,13 @@ export default {
6768
})
6869
},
6970
formatJson(filterVal, jsonData) {
70-
return jsonData.map(v => filterVal.map(j => v[j]))
71+
return jsonData.map(v => filterVal.map(j => {
72+
if (j === 'timestamp') {
73+
return parseTime(v[j])
74+
} else {
75+
return v[j]
76+
}
77+
}))
7178
}
7279
}
7380
}

0 commit comments

Comments
 (0)