0
votes

I use vue with Axios to read an RSS feed of book titles and display them in a list. Users have a search box to filter the results in the list. This works fine.

However, the transition does not have any effect.

HTML index file

<ul class="booklist">
  <my-book
          v-for="book in bookFeed"
          v-bind:id="book.id"
          v-bind:title="book.node_title"
          v-bind:body="book.body"
          v-bind:path="book.path"
          v-bind:author="book.author"
          v-bind:coverimg="book.medium_img" >
  </my-book>
</ul>

Vue js file

Vue.component('my-book', {
  props: ['title','body','coverimg','id','path','author'],
  template: `
     <transition name='section'>
       <li class="row-animated border-bo-dd mb10 pb10 imgshadow" >
         ...html content of a single book item
       </li>
     </transition> 
   `
});

CSS file

.section-leave-active,
.section-enter-active {
  transition: .5s;
}
.section-enter {
  transform: translateY(100%);
}
.section-leave-to {
  transform: translateY(-100%);
}

Any idea where my mistake is? Thank you for any hint. rhodes

1
<transition>'s should be followed by an element with v-if on it, unless obviously its a route transition - Lawrence Cherone

1 Answers

0
votes

Try to use transition-group component and place it instead of ul tag like :

<transition-group name="section" tag="ul" class="booklist">

  <my-book
          v-for="book in bookFeed"
          v-bind:id="book.id"
          v-bind:title="book.node_title"
          v-bind:body="book.body"
          v-bind:path="book.path"
          v-bind:author="book.author"
          v-bind:coverimg="book.medium_img" >
  </my-book>

</transition-group>