问题
I have a problem in the layout. Look at this :
https://codepen.io/positivethinking639/pen/YzzwYZq.
when the dialog appears, it looks strange. because the width of the row(<v-row justify="center">
) is bigger than the width of the dialog
. so when the modal dialog appears like there are 2 shadows.
I want width of the row(<v-row justify="center">
) is same with the width of the dialog
I had try it. But I did not find a solution. hope someone helps
回答1:
set your dialog to use auto width
.v-dialog {
width:unset;
}
use no-gutters on your row
<v-row no-gutters justify="center">
add x padding to your righthand column and remove the row=2
attribute
<v-col class='px-3' v-show="foo.date !== null"
回答2:
use v-card on v-col
<div id="app">
<v-app>
<v-content>
<v-container>
<v-dialog
v-for="foo, k in foos"
:key="foo.id"
:close-on-content-click="false"
transition="scale-transition"
:return-value.sync="foo.date"
max-width="500px"
min-width="500px"
v-model="modal[k]"
:ref="'dialog' + k"
>
<template v-slot:activator="{ on }">
<v-btn color="success" dark v-on="on">call date {{foo.id}} {{ foo.date }}</v-btn>
</template>
<v-card class="py-2">
<v-card-text>
<v-row justify="center" no-gutters align-content="center">
<v-col md="auto" justify-self="center">
<v-date-picker v-model="foo.date" @input="changeHours">
<div class="flex-grow-1"></div>
<v-btn text color="primary" @click="modal[k] = false">Cancel</v-btn>
<v-btn text color="primary" @click="$refs['dialog' + k][0].save(foo.date)">OK</v-btn>
</v-date-picker>
</v-col>
<v-slide-y-transition>
<v-col
sm="3"
xs="12"
v-show="foo.date !== null"
:style="{'background-color':'white'}"
>
<template v-for="allowedTime in allowedTimes">
<v-btn
@click="setTime(allowedTime)"
class="my-2"
:outlined="allowedTime !== time"
block
x-large
color="primary"
>{{ allowedTime }}</v-btn>
</template>
</v-col>
</v-slide-y-transition>
</v-row>
</v-card-text>
</v-card>
</v-dialog>
</v-container>
</v-content>
</v-app>
</div>
来源:https://stackoverflow.com/questions/58360321/how-can-i-set-layout-row-in-dialog-vuetify