Skip to content

Instantly share code, notes, and snippets.

@reireias
Created December 25, 2018 00:47
Show Gist options
  • Save reireias/eb074484b5219991d71328da18b8c444 to your computer and use it in GitHub Desktop.
Save reireias/eb074484b5219991d71328da18b8c444 to your computer and use it in GitHub Desktop.
v-flex move transition
<template>
<v-container grid-list-md>
<!-- simple -->
<div id="flip-list-demo" class="demo">
<transition-group name="flip-list" tag="ul">
<li v-for="item in items" :key="item">
{{ item }}
</li>
</transition-group>
</div>
<!-- v-flex -->
<transition-group name="cards" tag="div" class="layout row wrap">
<v-flex v-for="item in items" :key="item" xs1>
<v-card>
<v-card-title>
<h1>{{ item }}</h1>
</v-card-title>
</v-card>
</v-flex>
</transition-group>
<!-- button -->
<v-btn @click="shuffle">
shuffle
</v-btn>
</v-container>
</template>
<script>
export default {
data() {
return {
items: [1, 2, 3, 4]
}
},
methods: {
shuffle() {
const item = this.items.pop()
this.items.unshift(item)
}
}
}
</script>
<style>
.flip-list-move {
transition: transform 1s;
}
.cards-move {
transition: transform 1s;
}
</style>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment