|
1 | 1 | <template> |
2 | 2 | <div class="index-container"> |
3 | 3 | <Notice v-if="pagination.currentPage === 1" /> |
4 | | - <el-row> |
5 | | - <el-col :xs="24" :sm="12" :md="8" v-for="(item, index) in pages" :index="index"> |
6 | | - <div class="index-card-wrapper"> |
7 | | - <el-card class="index-card" shadow="always" :body-style="{ padding: '0px' }"> |
8 | | - <div class="index-card-cover" :style="`background-image: url(${item.cover});`"></div> |
9 | | - <div class="index-card-desc">{{item.desc}}</div> |
10 | | - <div class="index-card-pined" v-if="item.pined"> |
11 | | - <i class="el-icon-s-flag" /> |
12 | | - </div> |
13 | | - <router-link :to="item.path"> |
14 | | - <div class="index-card-title"> |
15 | | - {{item.title}} |
16 | | - </div> |
17 | | - <div class="index-card-meta"> |
18 | | - <div class="index-card-date"> |
19 | | - <i class="el-icon-edit-outline" /> |
20 | | - {{item.date}} |
21 | | - </div> |
22 | | - <div class="index-card-tag"> |
23 | | - <i class="el-icon-paperclip" /> |
24 | | - {{item.tag}} |
25 | | - </div> |
26 | | - </div> |
27 | | - </router-link> |
28 | | - </el-card> |
29 | | - </div> |
30 | | - </el-col> |
31 | | - </el-row> |
| 4 | + <Cards :pages="pages" /> |
32 | 5 | <el-pagination class="index-pagination" |
33 | 6 | @current-change="handlePagination" |
34 | 7 | layout="prev, pager, next" |
|
45 | 18 | import AllMixin from '../components/AllMixin' |
46 | 19 |
|
47 | 20 | import Notice from '../components/Notice' |
| 21 | + import Cards from '../components/Cards' |
48 | 22 |
|
49 | 23 | export default { |
50 | 24 | name: "Index", |
51 | | - mixins:[AllMixin], |
| 25 | + mixins: [AllMixin], |
52 | 26 | data() { |
53 | 27 | return { |
54 | 28 | pages: [], |
55 | 29 | pagination: {} |
56 | 30 | } |
57 | 31 | }, |
58 | 32 | components: { |
59 | | - Notice |
| 33 | + Notice, |
| 34 | + Cards |
60 | 35 | }, |
61 | 36 | methods: { |
62 | 37 | handlePagination(num) { |
|
72 | 47 | this.pages.push({ |
73 | 48 | cover: item.frontmatter.cover || `/cover/${matchedLength - matchedPages.indexOf(item)}.png`, |
74 | 49 | title: item.frontmatter.title || 'No title', |
75 | | - date: day(item.frontmatter.date || '1970/1/1').format('YYYY-MM-DD'), |
| 50 | + date: day(new Date(item.frontmatter.date || '1970/1/1')).format('YYYY-M-D'), |
76 | 51 | desc: item.frontmatter.description || 'No description', |
77 | 52 | tag: Array.isArray(item.frontmatter.tag) ? item.frontmatter.tag[0] : item.frontmatter.tag || 'No tag', |
78 | 53 | pined: !!item.frontmatter.pined, |
|
0 commit comments