【发布时间】:2019-11-01 04:33:49
【问题描述】:
我有 4 个 div(红、黄、绿、蓝) 就我而言,我每行有 2 个。 我需要种植第二个(黄色),在红色下方没有间隙,只有蓝色必须向下跟随黄色。
我有一支密码笔如果你想试试。 Code
<div id="app">
<v-app id="inspire">
<v-item-group>
<v-container>
<div class="row">
<v-col
v-for="(item, index) in colors"
:key="index"
cols="12"
md="6"
>
<v-card
class="align-center"
height="auto"
:color="item.color"
>
<v-card-text v-for="(c, ind) in item.content" :key="ind" @click="colors[index].content.push(c)">{{c}}</v-card-text>
</v-card>
</v-col>
</div>
</v-container>
</v-item-group>
</v-app>
</div>
new Vue({
el: '#app',
vuetify: new Vuetify(),
data: {
colors: [{color: 'red', content: ['sample content']},
{color: 'yellow', content: ['sample content']},
{color: 'green', content: ['sample content']},
{color: 'blue', content: ['sample content']}]
}
})
【问题讨论】:
-
相关:Evenly distribute elements in columns 总结:可能做不干净。
-
你是说你想让黄色垂直生长,这样绿色就不会被压下去?如果是这样,您可以将红色和绿色放在一列(6 宽)中,将黄色和蓝色放在第二列(6 宽)