如何在 Vuetify 中布局多个浮动操作按钮?
How to layout multiple Floating Action Buttons in Vuetify?
我想要在右下角有两个浮动操作按钮,一个在另一个上方(例如 google 地图)。
目前我在其中一个按钮上使用固定样式的底部偏移来执行此操作,如下所示:
<v-btn fab fixed bottom right>...</v-btn>
<v-btn fab fixed bottom right style="bottom: 90px">...</v-btn>
...实现此目的,但我不想对 90px 进行硬编码,我宁愿说 "I want two Floating Action Buttons, one vertically above the other"。
是否有 vuetify 方法来解决这个问题?
您可以将它们放在另一个元素中,使用一些自定义 CSS 来定位:
<template>
<v-layout column class="fab-container">
<v-btn fab>
<v-icon>add</v-icon>
</v-btn>
<v-btn fab>
<v-icon>remove</v-icon>
</v-btn>
</v-layout>
</template>
<style>
.fab-container {
position: fixed;
bottom: 0;
right: 0;
}
</style>
您可以像这样应用 class 标签:
<template>
<v-card>
<v-card-text style="height: 100px; position: relative">
<v-fab-transition>
<v-btn color="grey" dark absolute top right fab small>
<v-icon>mdi-bookmark-outline</v-icon>
</v-btn>
</v-fab-transition>
<v-spacer />
<v-fab-transition>
<v-btn color="grey" dark absolute top right fab small class="mr-6">
<v-icon>mdi-heart-outline</v-icon>
</v-btn>
</v-fab-transition>
</v-card-text>
</v-card>
</template>
我想要在右下角有两个浮动操作按钮,一个在另一个上方(例如 google 地图)。
目前我在其中一个按钮上使用固定样式的底部偏移来执行此操作,如下所示:
<v-btn fab fixed bottom right>...</v-btn>
<v-btn fab fixed bottom right style="bottom: 90px">...</v-btn>
...实现此目的,但我不想对 90px 进行硬编码,我宁愿说 "I want two Floating Action Buttons, one vertically above the other"。
是否有 vuetify 方法来解决这个问题?
您可以将它们放在另一个元素中,使用一些自定义 CSS 来定位:
<template>
<v-layout column class="fab-container">
<v-btn fab>
<v-icon>add</v-icon>
</v-btn>
<v-btn fab>
<v-icon>remove</v-icon>
</v-btn>
</v-layout>
</template>
<style>
.fab-container {
position: fixed;
bottom: 0;
right: 0;
}
</style>
您可以像这样应用 class 标签:
<template>
<v-card>
<v-card-text style="height: 100px; position: relative">
<v-fab-transition>
<v-btn color="grey" dark absolute top right fab small>
<v-icon>mdi-bookmark-outline</v-icon>
</v-btn>
</v-fab-transition>
<v-spacer />
<v-fab-transition>
<v-btn color="grey" dark absolute top right fab small class="mr-6">
<v-icon>mdi-heart-outline</v-icon>
</v-btn>
</v-fab-transition>
</v-card-text>
</v-card>
</template>