修复宫格布局没页10条以上数据情况下问题

xuhongjie
许宏杰 1 year ago
parent 6041c7e184
commit 184ca04b36

@ -71,7 +71,7 @@
width: 100%; width: 100%;
li { li {
width: 19%; width: 19%;
height: 49%; height: 48.5%;
margin-right: calc(1% + (2% / 8)); margin-right: calc(1% + (2% / 8));
margin-bottom: 1%; margin-bottom: 1%;
list-style: none; list-style: none;
@ -84,7 +84,7 @@
position: absolute; position: absolute;
top: 6%; top: 6%;
right: 10%; right: 10%;
font-size: 20px; font-size: 18px;
font-weight: bold; font-weight: bold;
color: #2aa984; color: #2aa984;
z-index: 10; z-index: 10;
@ -122,9 +122,10 @@
li:nth-of-type(5n) { li:nth-of-type(5n) {
margin-right: 0; margin-right: 0;
} }
li:nth-of-type(n + 2) {
margin-bottom: 0; // li:nth-of-type(n + 2) {
} // margin-bottom: 0;
// }
} }
::v-deep .pagination-container { ::v-deep .pagination-container {
height: 0 !important; height: 0 !important;

@ -11,9 +11,13 @@
> >
</div> </div>
<ul class="book-main" :style="{ height: tableHeigth + 'px' }"> <ul class="book-main" :style="listStyle">
<li v-for="item in certificatesList" :key="item.id"> <li
<div class="integral-num">50</div> v-for="(item, index) in certificatesList"
:key="item.id"
:style="{ marginBottom: isLastRow(index) ? '0px' : '' }"
>
<div class="integral-num">积分50</div>
<el-image <el-image
style="width: 100%; height: 87%" style="width: 100%; height: 87%"
:src="baseUrl + item.cover" :src="baseUrl + item.cover"
@ -54,7 +58,6 @@
</li> </li>
</ul> </ul>
<pagination <pagination
layout="total, prev, pager, next, jumper"
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
@ -122,9 +125,12 @@ import {
export default { export default {
data() { data() {
return { return {
listStyle: {
height: 0,
overflowY: "auto",
},
baseUrl: process.env.VUE_APP_BASE_API, baseUrl: process.env.VUE_APP_BASE_API,
certificatesList: [], certificatesList: [],
tableHeigth: 0,
loading: false, loading: false,
tableData: [], tableData: [],
total: 0, total: 0,
@ -143,12 +149,21 @@ export default {
created() { created() {
// // // //
this.$nextTick(() => { this.$nextTick(() => {
this.tableHeigth = this.listStyle.height =
this.$refs.main.offsetHeight - 40 - this.$refs.search.offsetHeight - 42; this.$refs.main.offsetHeight -
40 -
this.$refs.search.offsetHeight -
42 +
"px";
this.getList(); this.getList();
}); });
}, },
methods: { methods: {
isLastRow(index) {
const rowCount = Math.ceil(this.certificatesList.length / 5);
const row = Math.floor(index / 5);
return row === rowCount - 1;
},
/**搜索 */ /**搜索 */
handleSearch(keyWord) { handleSearch(keyWord) {
this.queryParams = { this.queryParams = {

@ -4,9 +4,13 @@
<MyInput v-model="queryParams.name" @clickSearch="handleSearch" /> <MyInput v-model="queryParams.name" @clickSearch="handleSearch" />
</div> </div>
<ul class="book-main" :style="{ height: tableHeigth + 'px' }"> <ul class="book-main" :style="listStyle">
<li v-for="item in certificatesList" :key="item.id"> <li
<div class="integral-num">50</div> v-for="(item, index) in certificatesList"
:key="item.id"
:style="{ marginBottom: isLastRow(index) ? '0px' : '' }"
>
<div class="integral-num">积分50</div>
<el-image <el-image
style="width: 100%; height: 87%" style="width: 100%; height: 87%"
:src="baseUrl + item.cover" :src="baseUrl + item.cover"
@ -25,7 +29,6 @@
</li> </li>
</ul> </ul>
<pagination <pagination
layout="total, prev, pager, next, jumper"
v-show="total > 0" v-show="total > 0"
:total="total" :total="total"
:page.sync="queryParams.pageNum" :page.sync="queryParams.pageNum"
@ -40,9 +43,12 @@ import { listCertificates } from "@/api/volunteer/gxhzs/gxhzsgl/index.js";
export default { export default {
data() { data() {
return { return {
listStyle: {
height: 0,
overflowY: "auto",
},
baseUrl: process.env.VUE_APP_BASE_API, baseUrl: process.env.VUE_APP_BASE_API,
certificatesList: [], certificatesList: [],
tableHeigth: 0,
loading: false, loading: false,
tableData: [], tableData: [],
total: 0, total: 0,
@ -58,12 +64,21 @@ export default {
created() { created() {
// // // //
this.$nextTick(() => { this.$nextTick(() => {
this.tableHeigth = this.listStyle.height =
this.$refs.main.offsetHeight - 40 - this.$refs.search.offsetHeight - 42; this.$refs.main.offsetHeight -
40 -
this.$refs.search.offsetHeight -
42 +
"px";
this.getList(); this.getList();
}); });
}, },
methods: { methods: {
isLastRow(index) {
const rowCount = Math.ceil(this.certificatesList.length / 5);
const row = Math.floor(index / 5);
return row === rowCount - 1;
},
/**兑换 */ /**兑换 */
conversion(item) { conversion(item) {
console.log(item); console.log(item);

@ -57,9 +57,9 @@ module.exports = {
sassOptions: { outputStyle: "expanded" }, sassOptions: { outputStyle: "expanded" },
}, },
// px to rem // px to rem
// postcss: { postcss: {
// plugins: [postcss], plugins: [postcss],
// }, },
}, },
}, },
configureWebpack: { configureWebpack: {

Loading…
Cancel
Save