|
@@ -7,7 +7,7 @@
|
|
|
</el-col>
|
|
|
<el-col :span="24" class="info">
|
|
|
<ul>
|
|
|
- <li v-for="(item, index) in contentList" :key="index" @click="$emit('fetch', item.id)">
|
|
|
+ <li v-for="(item, index) in list" :key="index" @click="$emit('fetch', item.id)">
|
|
|
<el-col :span="21" class="title textOver">{{ item.title }}</el-col>
|
|
|
<el-col :span="3" class="date">
|
|
|
{{ item.meta && item.meta.createdAt ? new Date(item.meta.createdAt).toLocaleDateString() : '' || '' }}
|
|
@@ -16,11 +16,11 @@
|
|
|
</ul>
|
|
|
<el-col class="page" :span="24">
|
|
|
<el-pagination
|
|
|
- @size-change="handleSizeChange"
|
|
|
@current-change="handleCurrentChange"
|
|
|
:current-page="currentPage"
|
|
|
- layout="total, prev, pager, next, jumper"
|
|
|
+ layout="total, prev, pager, next, jumper"
|
|
|
:total="total"
|
|
|
+ :page-size="pageSize"
|
|
|
>
|
|
|
</el-pagination>
|
|
|
</el-col>
|
|
@@ -38,6 +38,7 @@
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
+import _ from 'lodash';
|
|
|
export default {
|
|
|
name: 'rightcont',
|
|
|
props: {
|
|
@@ -48,6 +49,9 @@ export default {
|
|
|
components: {},
|
|
|
data: () => ({
|
|
|
currentPage: 1,
|
|
|
+ pageSize: 15,
|
|
|
+ origin: [],
|
|
|
+ list: [],
|
|
|
linkList: [
|
|
|
{
|
|
|
url: '',
|
|
@@ -78,11 +82,21 @@ export default {
|
|
|
created() {},
|
|
|
computed: {},
|
|
|
methods: {
|
|
|
- handleSizeChange(val) {
|
|
|
- console.log(`每页 ${val} 条`);
|
|
|
+ search(page = 1) {
|
|
|
+ this.$set(this, `list`, this.origin[page - 1]);
|
|
|
},
|
|
|
- handleCurrentChange(val) {
|
|
|
- console.log(`当前页: ${val}`);
|
|
|
+ handleCurrentChange(currentPage) {
|
|
|
+ this.search(currentPage);
|
|
|
+ },
|
|
|
+ },
|
|
|
+ watch: {
|
|
|
+ contentList: {
|
|
|
+ immediate: true,
|
|
|
+ deep: true,
|
|
|
+ handler(val) {
|
|
|
+ if (val && val.length > 0) this.$set(this, `origin`, _.chunk(val, this.pageSize));
|
|
|
+ this.search();
|
|
|
+ },
|
|
|
},
|
|
|
},
|
|
|
};
|