我正在尝试使用 vue 和 vuetify 添加一张卡片,这将占用我容器中的空间,使用 v-flex 创建一个水平卡片,其垂直行为方式相同。我尝试使用填充高度、child-flex 等添加 100% 的高度样式,但我无法获得卡片的大小来填充容器。调节高度的正确方法是什么?
参考: https ://vuetifyjs.com/en/components/cards
<div id="app">
<v-app id="inspire">
<v-toolbar color="green" dark fixed app>
<v-toolbar-title>My Application</v-toolbar-title>
</v-toolbar>
<v-content >
<v-container fluid fill-height >
<v-layout
justify-center
align-center
>
<v-flex text-xs-center >
<v-card class="elevation-20" >
<v-toolbar dark color="primary">
<v-toolbar-title>I want this to take up the whole space with slight padding</v-toolbar-title>
<v-spacer></v-spacer>
</v-toolbar>
<v-card-text>
</v-card-text>
</v-card>
</v-flex>
</v-layout>
</v-container>
</v-content>
<v-footer color="green" app inset>
<span class="white--text">© 2018</span>
</v-footer>
</v-app>
</div>
示例: https ://codepen.io/anon/pen/LmVJKx
原文由 Darwin 发布,翻译遵循 CC BY-SA 4.0 许可协议
Vuetify 对 高度 道具说: 手动定义卡片的高度
因此,在 v-card 元素中添加高度如下:
看到它在行动