【发布时间】:2021-09-19 04:30:54
【问题描述】:
我一直在寻找 vue 3 框架下带有引导程序的砌体布局的解决方案,但没有运气。使用带有砌体CDN 的 bootstrap 5 卡挤压并重叠卡,但仍然没有呈现预期的布局。也许我错过了什么。非常感谢任何帮助。
编辑:
- Here 是包含一些数据的代码沙箱。
- HTML example 与 codeply。
这是我的代码的一部分:
<template>
<div class="container">
<div class="row justify-content-center" data-masonry='{"percentPosition": true }'>
<div class="col-lg-3 col-md-4 col-sm-col" v-for="(newsPiece, index) in newsCollection" :key="index">
<div class="card shadow-sm mt-3 mx-1">
<img :src="newsPiece.urlToImage" alt="image link lost" data-bs-toggle="collapse"
:data-bs-target="'#collapseImage'+index">
<h5><a :href="newsPiece.url" target="_blank">{{ newsPiece.title }}</a></h5>
<div class="collapse" :id="'collapseImage'+index">
<div class="card-body-noborder">
<span v-html="newsPiece.description"></span>
</div>
</div>
<div class="card-footer">
{{ newsPiece.publishedAt.replace('T',' ').replace('Z','') }}
</div>
</div>
</div>
</div>
</div>
</template>
<style scoped>
.card {
width: 13rem;
border-radius:10px;
}
.row {
padding: 0 15%;
}
h5 {
font-size: 1rem;
}
.card-footer {
font-size: 1rem;
}
@media screen and (max-width:600px) {
.card {
width: 20rem;
border-radius:10px;
}
h5 {
font-size: 1.2rem;
}
}
</style>
【问题讨论】:
标签: html css vuejs3 bootstrap-5