【发布时间】:2021-02-16 12:34:52
【问题描述】:
我正在尝试动态更新 Vuetify <v-tabs-items> 组中显示的项目,但动画无法正常工作。当我选择一个新添加的选项卡时,动画总是表现得好像该选项卡在右侧,尽管它在 DOM 中位于左侧。如何更正此问题,以便选项卡在选项卡栏中出现的顺序反映了移动方向?
在此示例中,请注意对于原始选项卡,单击更右侧的选项卡会使其从右侧动画化。但是,在左侧添加新选项卡后,单击此新选项卡会使其从右侧滑入,而不是从左侧滑入。
<template>
<v-app>
<v-card>
<v-tabs v-model="chosenTab" grow>
<v-tab v-for="x in xs" :key="x">
{{ x }}
</v-tab>
</v-tabs>
<v-tabs-items v-model="chosenTab">
<v-tab-item v-for="x in xs" :key="x">
<v-card flat>
<v-card-text>
{{ x }}
</v-card-text>
</v-card>
</v-tab-item>
</v-tabs-items>
<v-card-actions>
<v-btn @click="xs.unshift('new-tab-' + xs.length)"> Add new tab </v-btn>
</v-card-actions>
</v-card>
</v-app>
</template>
<script>
export default {
data() {
return {
chosenTab: null,
xs: ["tab-0", "tab-1", "tab-2"],
};
},
};
</script>
【问题讨论】:
标签: javascript vue.js vuetify.js