Skip to content

Commit c70f388

Browse files
committed
fix:修复分页
1 parent e8eb4d0 commit c70f388

File tree

3 files changed

+5
-8
lines changed

3 files changed

+5
-8
lines changed

app/dao/article.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ class ArticleDao {
146146
}
147147
try {
148148
const article = await Article.scope('iv').findAndCountAll({
149-
// limit: page_size, //每页10条
149+
limit: page_size, //每页10条
150150
offset: (page - 1) * page_size,
151151
where: filter,
152152
order: [
@@ -170,8 +170,6 @@ class ArticleDao {
170170
rows = dataAndAdmin
171171
}
172172

173-
console.log(rows)
174-
console.log(Array.isArray(rows) && rows.length > 0)
175173
if (Array.isArray(rows) && rows.length > 0) {
176174
rows.sort((a, b) => b.sort_order - a.sort_order)
177175
}

app/dao/category.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ class CategoryDao {
124124
try {
125125
const category = await Category.scope('bh').findAndCountAll({
126126
where: params,
127-
// limit: page_size, //每页10条
127+
limit: page_size, //每页10条
128128
offset: (page - 1) * page_size,
129129
order: [
130130
['created_at', 'DESC']

frontend-boblog/pages/index.vue

+3-4
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
<a v-if="isClear" href="/">清空搜索条件</a>
3131
</div>
3232

33-
<div v-if="isLoad" class="more" @click="loadMore">
33+
<div v-if="isLoad" class="response-wrap more" @click="loadMore">
3434
<div class="more-text">点击加载更多</div>
3535
<div class="more-arrow">
3636
<img src="https://cdn.boblog.com/arrow.png" alt="" />
@@ -126,7 +126,7 @@ export default {
126126
})
127127
if (!err) {
128128
this.categoryId = id
129-
this.article.push(...res.data.data)
129+
this.article.data.push(...res.data.data.data)
130130
this.isLoad = res.data.data.meta.total_pages > this.page
131131
}
132132
},
@@ -204,8 +204,7 @@ export default {
204204
205205
.more {
206206
cursor: pointer;
207-
width: 1280px;
208-
margin: 0 auto;
207+
padding: 32px 0;
209208
display: flex;
210209
align-items: center;
211210
justify-content: center;

0 commit comments

Comments
 (0)