【发布时间】:2021-02-12 10:25:15
【问题描述】:
我想将组件更改为徽标图像和表单,当我单击徽标时,它会转换为表单。 阅读文件很简单,但我做不到。不知道是不是少了点什么。
索引.vue:
<template>
<v-app>
<transition name="fade" mode="out-in">
<Logo @click="show = !show" key="logo" />
<Form key="form" v-if="show" />
</transition>
</v-app>
</template>
<script>
export default {
components:{
Logo: () => import('./components/Logo-Image'),
Form: () => import('./components/Image-Form'),
}
}
</script>
<style>
.fade-enter-active,
.fade-leave-active {
transition: opacity 0.5s;
}
.fade-enter,
.fade-leave-to {
opacity: 0;
}
</style>
徽标.vue:
<template>
<v-container fill-height fluid>
<v-row align="center"
justify="center">
<v-col
align="center"
justify="center">
<a><v-img src="/img/logo.png" max-height="360" max-width="570"></v-img></a>
</v-col>
</v-row>
</v-container>
</template>
Form.vue
<template>
<v-container fill-height fluid>
<v-row align="center"
justify="center">
<v-col
align="center"
justify="center">
<v-card
max-width="300"
>
<v-img
src="/img/logo.png"
max-height="360"
max-width="520"
>
</v-img>
<v-card-text>
<v-text-field
label="CPF"
>
</v-text-field>
</v-card-text>
</v-card>
</v-col>
</v-row>
</v-container>
</template>
【问题讨论】:
-
你能展示你的 CSS 吗?如果您还没有创建一些过渡类,则需要。参见示例 CSS:vuejs.org/v2/guide/…
-
我用 CSS 更新了
标签: vue.js components css-transitions