【发布时间】:2020-09-03 18:19:15
【问题描述】:
我想对齐两个组件以在两列上显示一些数据,我遵循了官方教程Vuetify Grid。在我的案例中,组件像行列表一样固定,在屏幕上我放了红色方块来显示我的目标,并显示代码的结果。另外,我尝试将row 更改为column 但不起作用,它保持在两行。
<v-container>
<v-layout row>
<v-flex xs6>Associado: {{item.nameUser}}</v-flex>
<v-flex xs6>Associado: {{item.nameUser}}</v-flex>
</v-layout>
</v-container>
完整代码
<template>
<v-content class="pa-1" fluid>
<v-btn
color="blue"
dark
small
fixed
bottom
right
fab
@click="showRegisterTransactionDialog = true"
>
<v-icon>mdi-plus</v-icon>
</v-btn>
<v-data-table
:mobile-breakpoint="NaN"
:headers="headers"
:items="transactionsLocal"
:items-per-page="3000"
:hide-default-footer="true"
:single-expand="singleExpand"
:expanded.sync="expanded"
item-key="id"
show-expand
sort-by="showDate"
class="elevation-1"
>
<template v-slot:top>
<v-toolbar flat color="white">
<v-toolbar-title>Fluxo de caixa</v-toolbar-title>
<v-divider class="mx-4" inset vertical></v-divider>
<v-spacer></v-spacer>
</v-toolbar>
</template>
<template v-slot:item.value="{ item }">
<div style="color:green;" v-if="item.type == 'entry'">{{item.value}}</div>
<div v-else style="color:red;">{{item.value}}</div>
</template>
<template v-slot:expanded-item="{ headers, item }">
<v-container>
<v-layout row>
<v-flex xs6>Associado: {{item.nameUser}}</v-flex>
<v-flex xs6>Associado: {{item.nameUser}}</v-flex>
</v-layout>
</v-container>
</template>
</v-data-table>
<RegisterTransactionDialog
@hideRegisterTransactionDialog="showRegisterTransactionDialog = false"
:show="showRegisterTransactionDialog"
></RegisterTransactionDialog>
</v-content>
</template>
更新
我在v-container 上将背景颜色设置为黑色,然后发现问题出在它上面。但是,我也不知道修复它。
<v-container style="background-color: black;">
【问题讨论】:
-
无法复制。还有其他东西弄乱了你的布局。
-
我在这里测试您的案例时没有发现任何问题:codepen.io/salihtopcu/pen/yLYQYob 您确定没有可能导致此问题的样式定义吗?
-
不,没有。我刚刚发布了整个代码,它在
v-data-table中使用,也许有事要做。
标签: javascript vue.js grid vuetify.js