我想将所有七个按钮居中对齐。正如你所看到的,与第一个相比,最后一个有点偏离。
我如何实现这一目标?我已经试过justify="center"和justify="space-around"
这是我的代码:
<v-row no-gutters justify="space-around">
<v-col v-for="(item, index) in buttons" :key="index">
<toggle-button
:weekday="item.weekday"
:button="item.state"
></toggle-button>
</v-col>
</v-row>
Run Code Online (Sandbox Code Playgroud)
这是toggle-button组件:
<template>
<v-btn
outlined
depressed
:class="button ? 'primary white--text' : 'outlined'"
@click="button ? (button = false) : (button = true)"
v-model="button"
icon
>
{{ $t("roomservice.weekdays." + weekday) }}
</v-btn>
</template>
<script>
export default {
data() {
return {};
},
props: ["button", "weekday"]
};
</script>
Run Code Online (Sandbox Code Playgroud)
Ja9*_*35h 13
v-col 不是 flex 并且里面的内容(切换按钮)有理由从左边开始。
你可以通过添加来解决这个class="d-flex justify-center"问题v-col
<v-row no-gutters justify="space-around">
<v-col
class="d-flex justify-center"
v-for="(item, index) in buttons"
:key="index">
<toggle-button
:weekday="item.weekday"
:button="item.state"
></toggle-button>
</v-col>
</v-row>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6922 次 |
| 最近记录: |