我有两个段落(一个大的和一个小的)在一个v卡,开关按钮点击。是否有一种方法,使卡动画,就像它正在扩展,同时切换。下面是它的样子
<v-card>
<v-btn @click="show=!show" flat>show</v-btn>
<v-card-text v-show="show">
<!-- short paragraph -->
</v-card-text>
<v-card-text v-show="!show">
<!-- long paragraph -->
</v-card-text>
</v-card>假设show是在vue对象中定义的变量。
发布于 2019-06-24 11:11:12
您可以从Vuetify:https://vuetifyjs.com/en/framework/transitions#expand-transition中使用https://vuetifyjs.com/en/framework/transitions#expand-transition。
只需使用一个v-card-text,其中每个短段落和长段包含一个div,然后将每个段落包装成v-expand-transition
<v-card-text>
<v-expand-transition>
<div v-show="show">This is a short paragraph</div>
</v-expand-transition>
<v-expand-transition>
<div v-show="!show">
<p>A looooong</p>
<p>paragraph</p>
</div>
</v-expand-transition>
</v-card-text>代码沙箱上的工作示例:https://codesandbox.io/s/stack-overflow-q46305305-4qq4940x5w
https://stackoverflow.com/questions/46305305
复制相似问题