vue.js - 如何在 VueJS 中制作图像网格堆栈?
问题描述
我有垂直和水平的图片,我想制作瀑布/砖石/pinterest网格布局,我发现可以制作“堆栈”网格,但我尝试了许多不同的代码,但我仍然无法制作它,因为我想将它实现到我现有的代码中(而且我太新鲜了,不能这样做)。也许有更简单的方法来做到这一点?先感谢您
<template >
<v-container
fluid
grid-list-xs
text-xs-center
fill-height
max-height: 100vh;
class="product"
>
<v-layout align-center justify-center row wrap class="container">
<v-flex xs10 sm6 md4 lg3 class="mr-2 mb-2" v-for="(obj,key) in portfolio" :key="key">
<v-hover>
<v-card flat slot-scope="{ hover }" class="mx-auto" color="transparent">
<v-img class="image" v-bind:src="obj.img">
<v-expand-transition>
<div
v-if="hover"
class="d-flex transition-fast-in-fast-out grey darken-4 v-card--reveal display-3 white--text"
style="height: 100%;"
>
<h4>{{ obj.title }}</h4>
</div>
</v-expand-transition>
</v-img>
</v-card>
</v-hover>
</v-flex>
</v-layout>
</v-container>
</template>
解决方案
你可能需要一个顶级的 v-layout 和 v-flex。
试试这样:
<template>
<v-layout justify-center>
<v-flex xs12>
<v-card>
<v-container
fluid
grid-list-xs
>
<v-layout row wrap>
<v-flex
xs10 sm6 md4 lg3 class="mr-2 mb-2" v-for="(obj,key) in portfolio" :key="key"
>
<v-card>
<v-img
class="image" :src="obj.img"
>
<v-expand-transition>
<div
v-if="hover"
class="d-flex transition-fast-in-fast-out grey darken-4 v-card--reveal display-3 white--text"
style="height: 100%;"
>
<h4>{{ obj.title }}</h4>
</div>
</v-expand-transition>
</v-img>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-card>
</v-flex>
</v-layout>
</template>
推荐阅读
- ios - 创建可扩展的表格视图?
- javascript - MutationObserver 回调未在 Firefox 中调用,但在 Chrome 中调用
- python - [python]:将字典项的 pandas 列转换为 DataFrame 中的单个行
- android - Jetpack Compose LazyVerticalGrid 重组
- kubernetes - 带有 azure/k8s-bake@v1 的 github action 自托管运行器
- python - 如何通过 python 访问托管在网络上的文件?
- mongodb - $group 和 $map 在 mongodb 中无法正常工作
- python - 经过训练的 SVM 在测试集上的准确率接近 100%,但是当使用“cv2.VideoCapture(0)”中的帧时,它每次都会给出肯定的结果
- excel - 从跨越多列的名称范围编译不同值的列表
- django - 无效凭证的自定义错误响应 [RestFramework_JWT]