【发布时间】:2022-12-11 11:23:57
【问题描述】:
我正在尝试将我的身份验证组件(v-card)水平和垂直居中。我尝试了各种解决方案,例如行上的justify=center 和align=center,v-容器上的填充高度,v-容器上的class="fill-height",但它不起作用。我在这里做错了什么?
代码 :
<script setup lang="ts">
import { useUserStore } from "../../stores/user";
const store = useUserStore();
</script>
<template>
<v-card width="800" >
<v-card-title>
Authentication
</v-card-title>
<v-card-subtitle>
login with username and password
</v-card-subtitle>
<v-card-text>
<v-row>
<v-col cols="12" md="6">
<v-text-field v-model="store.username" label="Username"></v-text-field>
</v-col>
<v-col cols="12" md="6">
<v-text-field v-model="store.password" label="Password"></v-text-field>
</v-col>
</v-row>
</v-card-text>
</v-card>
</template>
<script setup lang="ts">
import Auth from "../components/auth/Auth.component.vue"
</script>
<template>
<v-container>
<v-row style="border:1px solid red;" fill-height>
<v-col class="d-flex justify-center items-center">
<Auth/>
</v-col>
</v-row>
</v-container>
</template>
<template>
<v-app>
<v-main>
<router-view></router-view>
</v-main>
</v-app>
</template>
<script setup lang="ts">
</script>
【问题讨论】:
-
在
v-col的v-row上给align-center justify-center上课。从v-col中删除所有类
标签: vue.js vuetify.js