Commit 4ab1ce91 authored by 徐一鸣's avatar 徐一鸣

Merge branch 'xym' into dev

parents 7d5387f7 8442c477
...@@ -55,6 +55,7 @@ export default { ...@@ -55,6 +55,7 @@ export default {
flex-shrink: 0; flex-shrink: 0;
padding-top: 5px; padding-top: 5px;
margin-right: 27px; margin-right: 27px;
margin-left: 10px;
} }
.comment-right { .comment-right {
font-size: 16px; font-size: 16px;
......
<template>
<div class="comments_pagination">
<div class="total_info">
<span>{{ `共${total}个条目` }}</span>
</div>
<div class="page_size_action">
<span>每页行数:</span>
<el-select :value="pageSize" @change="sizeChange">
<el-option
v-for="item in pageSizes"
:label="item"
:value="item"
:key="item"
></el-option>
</el-select>
</div>
<div class="page_action">
<a :class="{ disabled: preDisabled }" @click.prevent="prePage">
<i class="el-icon-arrow-left"></i>
</a>
<span>{{ `第${currentPage}页 / 共${totalPages}页` }}</span>
<a :class="{ disabled: nextDisabled }" @click.prevent="nextPage">
<i class="el-icon-arrow-right"></i>
</a>
</div>
</div>
</template>
<script>
export default {
props: {
total: {
type: Number,
required: true,
},
pageSizes: {
type: Array,
required: true,
},
pageSize: {
type: Number,
required: true,
},
currentPage: {
type: Number,
required: true,
},
},
data: () => ({}),
computed: {
totalPages() {
return Math.ceil(this.total / this.pageSize);
},
preDisabled() {
return this.currentPage === 1;
},
nextDisabled() {
return this.currentPage === this.totalPages;
},
},
methods: {
sizeChange(value) {
this.$emit("size-change", value);
},
prePage() {
if (this.preDisabled) {
return;
}
this.$emit("current-change", this.currentPage - 1);
},
nextPage() {
if (this.nextDisabled) {
return;
}
this.$emit("current-change", this.currentPage + 1);
},
},
};
</script>
<style scoped>
.comments_pagination {
display: flex;
justify-content: flex-start;
align-items: center;
font-size: 14px;
line-height: 25px;
color: #333;
}
.total_info {
flex-grow: 1;
}
.page_size_action {
margin-left: 50px;
}
.page_size_action > .el-select {
width: 70px;
}
.page_action {
user-select: none;
margin-left: 50px;
}
.page_action > a {
cursor: pointer;
}
.page_action > a > i {
font-weight: bold;
}
.page_action > a.disabled {
opacity: 0.5;
cursor: not-allowed;
}
</style>
<style>
.page_size_action > .el-select .el-input__inner,
.page_size_action > .el-select .el-input.is-focus .el-input__inner {
border: 1px solid #fff;
}
</style>
...@@ -2,30 +2,27 @@ ...@@ -2,30 +2,27 @@
<div class="service_tab-comments"> <div class="service_tab-comments">
<comments-score :data="data.baseInfo"></comments-score> <comments-score :data="data.baseInfo"></comments-score>
<comments-list :data="data.ffpjxxList"></comments-list> <comments-list :data="data.ffpjxxList"></comments-list>
<comments-pagination
<div class="comments_pages">
<el-pagination
@size-change="handleSizeChange"
@current-change="handleCurrentChange"
:total="data.baseInfo.total" :total="data.baseInfo.total"
:page-sizes="[10, 50, 100]" :page-sizes="pageSizes"
:current-page="1" :page-size="pageSize"
:page-size="10" :current-page="currentPage"
layout="total, sizes, prev, pager, next, jumper" @size-change="changePageSize"
> @current-change="changeCurrentPage"
</el-pagination> ></comments-pagination>
</div>
</div> </div>
</template> </template>
<script> <script>
import commentsScore from "@/components/comments-score"; import commentsScore from "@/components/comments-score";
import commentsList from "@/components/comments-list"; import commentsList from "@/components/comments-list";
import commentsPagination from "@/components/comments-pagination";
export default { export default {
components: { components: {
commentsScore, commentsScore,
commentsList, commentsList,
commentsPagination,
}, },
props: { props: {
data: { data: {
...@@ -33,13 +30,18 @@ export default { ...@@ -33,13 +30,18 @@ export default {
required: true, required: true,
}, },
}, },
data: () => ({}), data: () => ({
pageSizes: [10, 50, 100],
pageSize: 10,
currentPage: 1,
}),
methods: { methods: {
handleSizeChange(val) { changePageSize(value) {
console.log(`每页 ${val} 条`); this.pageSize = value;
this.currentPage = 1;
}, },
handleCurrentChange(val) { changeCurrentPage(value) {
console.log(`当前页: ${val}`); this.currentPage = value;
}, },
}, },
created() {}, created() {},
...@@ -47,8 +49,14 @@ export default { ...@@ -47,8 +49,14 @@ export default {
</script> </script>
<style scoped> <style scoped>
.comments_pages { .service_tab-comments {
text-align: center; padding: 35px 20px 20px;
margin-top: 20px; }
.service_tab-comments > .comments_score,
.service_tab-comments > .comments_list {
padding: 0 30px;
}
.service_tab-comments > .comments_pagination {
margin-top: 60px;
} }
</style> </style>
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment