2017-12-20 18 views
2

動的に追加するときに<tr>をアニメーション化したいと思います。しかし、それは。ここに私のコードです。ここでVue.jsでの遷移が正しく動作していません

<tbody> 
    <transition-group tag="tr" enter-active-class="animated fadeInUp">  
      <tr v-for="(product, index) in products" v-bind:key="product">      
      <td>{{ index + 1 }}</td> 
      <td>{{ product.name }}</td> 
      <td>{{ product.quantity }}</td> 
      <td> 
       {{ product.price }} 
       <span class="glyphicon glyphicon-remove control-btn pull-right" @click="removeProduct(index)"></span> 
       <span class="glyphicon glyphicon-pencil control-btn pull-right" @click="show(index)"></span> 
      </td>      
      </tr> 
    </transition-group> 
    <!-- Итого -->   
    <tr> 
     <td></td> 
     <td></td> 
     <td></td> 
     <td><strong>Итог:</strong> {{ total }}</td> 
    </tr> 
</tbody> 

Screenshot of the DevTools

+0

ただ、この問題を読んで、私はそれはあなたを助けることを願っています:https://github.com/vuejs/vue/issues/3907 –

+0

@VitalyMatvievich私はこの問題を以前に見たことがありますが、それは私を助けてくれるものではありません。他のアイデア?ありがとう。 –

+0

私は唯一の方法はテーブルを他のタグに変更することだと思います。それを見てください:https://jsfiddle.net/jaco2h22/57/。テーブルは、ここで必要な動作を提供しません。それはあなたが期待するものではありませんが、私はそれがここの唯一の解決策だと思います。たとえば、プロジェクトが可能であれば、レイアウトを柔軟にするためにすべてを変更していました。 –

答えて

0

のソリューションです:

<transition-group tag="tbody" enter-active-class="animated fadeInUp">     
    <tr v-for="(product, index) in products" v-bind:key="index">      
      <td>{{ index + 1 }}</td> 
      <td>{{ product.name }}</td> 
      <td>{{ product.quantity }}</td> 
      <td> 
      {{ product.price }} 
      <span class="glyphicon glyphicon-remove control-btn pull-right" @click="removeProduct(index)"></span> 
      <span class="glyphicon glyphicon-pencil control-btn pull-right" @click="show(index)"></span> 
      </td>      
    </tr> 
</transition-group> 
関連する問題