Vuejs list reorder doesn't trigger transitions










3















I've been doing some vuejs for almost a year now and I never really got animations and transitions to work, it seems very unclear to me how all this is supposed to work and today I decided to try and finally understand them but once again I am stuck, the transition simply won't work and I don't understand what I'm doing wrong.
Here is my code:



The HTML



<div id="app">
<div class="row">
<div class="container-fluid">
<transition-group name="flip-list" tag="div" class="row horizontal-scroll">
<div class="col-xs-12 col-md-2 col-lg-2 col-card"
v-for="(someCard, index) in someCards" v-bind:key="index">
<div class="some-card" @click="changeOrder(someCard)">
someCard.someTitle
</div>
</div>
</transition-group>
</div>
</div>
</div>


The JS



new Vue(
el: "#app",
data:
someCards: [

order: 2,
someTitle: 'Title 1'
,

order: 2,
someTitle: 'Title 2'
,

order: 2,
someTitle: 'Title 3'
,

order: 3,
someTitle: 'Title 4'
,

order: 3,
someTitle: 'Title 5'
,

order: 1,
someTitle: 'Title 6'
,

order: 1,
someTitle: 'Title 7'
,

order: 1,
someTitle: 'Title 8'
,

order: 3,
someTitle: 'Title 1'

]
,
methods:
changeOrder(someCardData)
let newRandom = Math.floor(Math.random() * 3) + 1;
while (newRandom === someCardData.order)
newRandom = Math.floor(Math.random() * 3) + 1;

someCardData.order = newRandom;
this.reorderList();
,
reorderList()
this.someCards.sort(function(objA, objB)
return objA.order - objB.order;
)
,

)


The CSS



/* default */
body
background: #20262E;
padding: 20px;
font-family: Helvetica;

#app
background: #fff;
border-radius: 4px;
padding: 20px;
transition: all 0.2s;

/* bootstrap */
.row
display: -ms-flexbox;
display: flex;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-right: -15px;
margin-left: -15px;

.col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col, .col-auto, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm, .col-sm-auto, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md, .col-md-auto, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg, .col-lg-auto, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl, .col-xl-auto
position: relative;
width: 100%;
min-height: 1px;
padding-right: 15px;
padding-left: 15px;


/* my css */
.horizontal-scroll
overflow-x: auto;
-ms-flex-wrap: nowrap;
flex-wrap: nowrap;

.col-card
max-width: 14%;

.some-card
height: 220px;
font-size: 16px;
text-align: center;
padding-right: 5px;
margin-top: 5px;
-webkit-box-shadow: 1px 1px 5px rgba(0,0,0,.1);
box-shadow: 1px 1px 5px rgba(0,0,0,.1);
border-radius: 2px;
background: #fff;
margin-bottom: 20px;
position: relative;
border-top-style: solid;

.flip-list-move
transition: transform 1s;



https://jsfiddle.net/eywraw8t/459088/



I am trying to have an animation triggered when I reorder a card in a list of cards aligned in a row. To change the position of a card, simply click on it. The reorder works but no transition is done.



I used this documentation
https://vuejs.org/v2/guide/transitions.html#List-Move-Transitions
and have seen a couple of fairly easy tutorials but I must be missing something. Can someone please check the code out and tell me what it is ?



Thanks










share|improve this question


























    3















    I've been doing some vuejs for almost a year now and I never really got animations and transitions to work, it seems very unclear to me how all this is supposed to work and today I decided to try and finally understand them but once again I am stuck, the transition simply won't work and I don't understand what I'm doing wrong.
    Here is my code:



    The HTML



    <div id="app">
    <div class="row">
    <div class="container-fluid">
    <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
    <div class="col-xs-12 col-md-2 col-lg-2 col-card"
    v-for="(someCard, index) in someCards" v-bind:key="index">
    <div class="some-card" @click="changeOrder(someCard)">
    someCard.someTitle
    </div>
    </div>
    </transition-group>
    </div>
    </div>
    </div>


    The JS



    new Vue(
    el: "#app",
    data:
    someCards: [

    order: 2,
    someTitle: 'Title 1'
    ,

    order: 2,
    someTitle: 'Title 2'
    ,

    order: 2,
    someTitle: 'Title 3'
    ,

    order: 3,
    someTitle: 'Title 4'
    ,

    order: 3,
    someTitle: 'Title 5'
    ,

    order: 1,
    someTitle: 'Title 6'
    ,

    order: 1,
    someTitle: 'Title 7'
    ,

    order: 1,
    someTitle: 'Title 8'
    ,

    order: 3,
    someTitle: 'Title 1'

    ]
    ,
    methods:
    changeOrder(someCardData)
    let newRandom = Math.floor(Math.random() * 3) + 1;
    while (newRandom === someCardData.order)
    newRandom = Math.floor(Math.random() * 3) + 1;

    someCardData.order = newRandom;
    this.reorderList();
    ,
    reorderList()
    this.someCards.sort(function(objA, objB)
    return objA.order - objB.order;
    )
    ,

    )


    The CSS



    /* default */
    body
    background: #20262E;
    padding: 20px;
    font-family: Helvetica;

    #app
    background: #fff;
    border-radius: 4px;
    padding: 20px;
    transition: all 0.2s;

    /* bootstrap */
    .row
    display: -ms-flexbox;
    display: flex;
    -ms-flex-wrap: wrap;
    flex-wrap: wrap;
    margin-right: -15px;
    margin-left: -15px;

    .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col, .col-auto, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm, .col-sm-auto, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md, .col-md-auto, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg, .col-lg-auto, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl, .col-xl-auto
    position: relative;
    width: 100%;
    min-height: 1px;
    padding-right: 15px;
    padding-left: 15px;


    /* my css */
    .horizontal-scroll
    overflow-x: auto;
    -ms-flex-wrap: nowrap;
    flex-wrap: nowrap;

    .col-card
    max-width: 14%;

    .some-card
    height: 220px;
    font-size: 16px;
    text-align: center;
    padding-right: 5px;
    margin-top: 5px;
    -webkit-box-shadow: 1px 1px 5px rgba(0,0,0,.1);
    box-shadow: 1px 1px 5px rgba(0,0,0,.1);
    border-radius: 2px;
    background: #fff;
    margin-bottom: 20px;
    position: relative;
    border-top-style: solid;

    .flip-list-move
    transition: transform 1s;



    https://jsfiddle.net/eywraw8t/459088/



    I am trying to have an animation triggered when I reorder a card in a list of cards aligned in a row. To change the position of a card, simply click on it. The reorder works but no transition is done.



    I used this documentation
    https://vuejs.org/v2/guide/transitions.html#List-Move-Transitions
    and have seen a couple of fairly easy tutorials but I must be missing something. Can someone please check the code out and tell me what it is ?



    Thanks










    share|improve this question
























      3












      3








      3








      I've been doing some vuejs for almost a year now and I never really got animations and transitions to work, it seems very unclear to me how all this is supposed to work and today I decided to try and finally understand them but once again I am stuck, the transition simply won't work and I don't understand what I'm doing wrong.
      Here is my code:



      The HTML



      <div id="app">
      <div class="row">
      <div class="container-fluid">
      <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
      <div class="col-xs-12 col-md-2 col-lg-2 col-card"
      v-for="(someCard, index) in someCards" v-bind:key="index">
      <div class="some-card" @click="changeOrder(someCard)">
      someCard.someTitle
      </div>
      </div>
      </transition-group>
      </div>
      </div>
      </div>


      The JS



      new Vue(
      el: "#app",
      data:
      someCards: [

      order: 2,
      someTitle: 'Title 1'
      ,

      order: 2,
      someTitle: 'Title 2'
      ,

      order: 2,
      someTitle: 'Title 3'
      ,

      order: 3,
      someTitle: 'Title 4'
      ,

      order: 3,
      someTitle: 'Title 5'
      ,

      order: 1,
      someTitle: 'Title 6'
      ,

      order: 1,
      someTitle: 'Title 7'
      ,

      order: 1,
      someTitle: 'Title 8'
      ,

      order: 3,
      someTitle: 'Title 1'

      ]
      ,
      methods:
      changeOrder(someCardData)
      let newRandom = Math.floor(Math.random() * 3) + 1;
      while (newRandom === someCardData.order)
      newRandom = Math.floor(Math.random() * 3) + 1;

      someCardData.order = newRandom;
      this.reorderList();
      ,
      reorderList()
      this.someCards.sort(function(objA, objB)
      return objA.order - objB.order;
      )
      ,

      )


      The CSS



      /* default */
      body
      background: #20262E;
      padding: 20px;
      font-family: Helvetica;

      #app
      background: #fff;
      border-radius: 4px;
      padding: 20px;
      transition: all 0.2s;

      /* bootstrap */
      .row
      display: -ms-flexbox;
      display: flex;
      -ms-flex-wrap: wrap;
      flex-wrap: wrap;
      margin-right: -15px;
      margin-left: -15px;

      .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col, .col-auto, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm, .col-sm-auto, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md, .col-md-auto, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg, .col-lg-auto, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl, .col-xl-auto
      position: relative;
      width: 100%;
      min-height: 1px;
      padding-right: 15px;
      padding-left: 15px;


      /* my css */
      .horizontal-scroll
      overflow-x: auto;
      -ms-flex-wrap: nowrap;
      flex-wrap: nowrap;

      .col-card
      max-width: 14%;

      .some-card
      height: 220px;
      font-size: 16px;
      text-align: center;
      padding-right: 5px;
      margin-top: 5px;
      -webkit-box-shadow: 1px 1px 5px rgba(0,0,0,.1);
      box-shadow: 1px 1px 5px rgba(0,0,0,.1);
      border-radius: 2px;
      background: #fff;
      margin-bottom: 20px;
      position: relative;
      border-top-style: solid;

      .flip-list-move
      transition: transform 1s;



      https://jsfiddle.net/eywraw8t/459088/



      I am trying to have an animation triggered when I reorder a card in a list of cards aligned in a row. To change the position of a card, simply click on it. The reorder works but no transition is done.



      I used this documentation
      https://vuejs.org/v2/guide/transitions.html#List-Move-Transitions
      and have seen a couple of fairly easy tutorials but I must be missing something. Can someone please check the code out and tell me what it is ?



      Thanks










      share|improve this question














      I've been doing some vuejs for almost a year now and I never really got animations and transitions to work, it seems very unclear to me how all this is supposed to work and today I decided to try and finally understand them but once again I am stuck, the transition simply won't work and I don't understand what I'm doing wrong.
      Here is my code:



      The HTML



      <div id="app">
      <div class="row">
      <div class="container-fluid">
      <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
      <div class="col-xs-12 col-md-2 col-lg-2 col-card"
      v-for="(someCard, index) in someCards" v-bind:key="index">
      <div class="some-card" @click="changeOrder(someCard)">
      someCard.someTitle
      </div>
      </div>
      </transition-group>
      </div>
      </div>
      </div>


      The JS



      new Vue(
      el: "#app",
      data:
      someCards: [

      order: 2,
      someTitle: 'Title 1'
      ,

      order: 2,
      someTitle: 'Title 2'
      ,

      order: 2,
      someTitle: 'Title 3'
      ,

      order: 3,
      someTitle: 'Title 4'
      ,

      order: 3,
      someTitle: 'Title 5'
      ,

      order: 1,
      someTitle: 'Title 6'
      ,

      order: 1,
      someTitle: 'Title 7'
      ,

      order: 1,
      someTitle: 'Title 8'
      ,

      order: 3,
      someTitle: 'Title 1'

      ]
      ,
      methods:
      changeOrder(someCardData)
      let newRandom = Math.floor(Math.random() * 3) + 1;
      while (newRandom === someCardData.order)
      newRandom = Math.floor(Math.random() * 3) + 1;

      someCardData.order = newRandom;
      this.reorderList();
      ,
      reorderList()
      this.someCards.sort(function(objA, objB)
      return objA.order - objB.order;
      )
      ,

      )


      The CSS



      /* default */
      body
      background: #20262E;
      padding: 20px;
      font-family: Helvetica;

      #app
      background: #fff;
      border-radius: 4px;
      padding: 20px;
      transition: all 0.2s;

      /* bootstrap */
      .row
      display: -ms-flexbox;
      display: flex;
      -ms-flex-wrap: wrap;
      flex-wrap: wrap;
      margin-right: -15px;
      margin-left: -15px;

      .col-1, .col-2, .col-3, .col-4, .col-5, .col-6, .col-7, .col-8, .col-9, .col-10, .col-11, .col-12, .col, .col-auto, .col-sm-1, .col-sm-2, .col-sm-3, .col-sm-4, .col-sm-5, .col-sm-6, .col-sm-7, .col-sm-8, .col-sm-9, .col-sm-10, .col-sm-11, .col-sm-12, .col-sm, .col-sm-auto, .col-md-1, .col-md-2, .col-md-3, .col-md-4, .col-md-5, .col-md-6, .col-md-7, .col-md-8, .col-md-9, .col-md-10, .col-md-11, .col-md-12, .col-md, .col-md-auto, .col-lg-1, .col-lg-2, .col-lg-3, .col-lg-4, .col-lg-5, .col-lg-6, .col-lg-7, .col-lg-8, .col-lg-9, .col-lg-10, .col-lg-11, .col-lg-12, .col-lg, .col-lg-auto, .col-xl-1, .col-xl-2, .col-xl-3, .col-xl-4, .col-xl-5, .col-xl-6, .col-xl-7, .col-xl-8, .col-xl-9, .col-xl-10, .col-xl-11, .col-xl-12, .col-xl, .col-xl-auto
      position: relative;
      width: 100%;
      min-height: 1px;
      padding-right: 15px;
      padding-left: 15px;


      /* my css */
      .horizontal-scroll
      overflow-x: auto;
      -ms-flex-wrap: nowrap;
      flex-wrap: nowrap;

      .col-card
      max-width: 14%;

      .some-card
      height: 220px;
      font-size: 16px;
      text-align: center;
      padding-right: 5px;
      margin-top: 5px;
      -webkit-box-shadow: 1px 1px 5px rgba(0,0,0,.1);
      box-shadow: 1px 1px 5px rgba(0,0,0,.1);
      border-radius: 2px;
      background: #fff;
      margin-bottom: 20px;
      position: relative;
      border-top-style: solid;

      .flip-list-move
      transition: transform 1s;



      https://jsfiddle.net/eywraw8t/459088/



      I am trying to have an animation triggered when I reorder a card in a list of cards aligned in a row. To change the position of a card, simply click on it. The reorder works but no transition is done.



      I used this documentation
      https://vuejs.org/v2/guide/transitions.html#List-Move-Transitions
      and have seen a couple of fairly easy tutorials but I must be missing something. Can someone please check the code out and tell me what it is ?



      Thanks







      vue.js vuejs2 vuejs-transition






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 14 '18 at 11:49









      manumanu

      390522




      390522






















          1 Answer
          1






          active

          oldest

          votes


















          3














          It's because you're using the index as a key. The index will always be the same for the same position even if the card changes. I'd give each card a unique id and then use that as a key instead ..






          new Vue(
          el: "#app",
          data:
          someCards: [
          id: 0,
          order: 2,
          someTitle: 'Title 1'
          ,

          id: 1,
          order: 2,
          someTitle: 'Title 2'
          ,

          id: 2,
          order: 2,
          someTitle: 'Title 3'
          ,

          id: 3,
          order: 3,
          someTitle: 'Title 4'
          ,

          id: 4,
          order: 3,
          someTitle: 'Title 5'
          ,

          id: 5,
          order: 1,
          someTitle: 'Title 6'
          ,

          id: 6,
          order: 1,
          someTitle: 'Title 7'
          ,

          id: 7,
          order: 1,
          someTitle: 'Title 8'
          ,

          id: 8,
          order: 3,
          someTitle: 'Title 1'

          ]
          ,
          methods:
          changeOrder(someCardData)
          let newRandom = Math.floor(Math.random() * 3) + 1;
          while (newRandom === someCardData.order)
          newRandom = Math.floor(Math.random() * 3) + 1;

          someCardData.order = newRandom;
          this.reorderList();
          ,
          reorderList()
          this.someCards.sort(function(objA, objB)
          return objA.order - objB.order;
          )
          ,

          )

          /* default */

          body
          background: #20262E;
          padding: 20px;
          font-family: Helvetica;


          #app
          background: #fff;
          border-radius: 4px;
          padding: 20px;
          transition: all 0.2s;



          /* bootstrap */

          .row
          display: -ms-flexbox;
          display: flex;
          -ms-flex-wrap: wrap;
          flex-wrap: wrap;
          margin-right: -15px;
          margin-left: -15px;


          .col-1,
          .col-2,
          .col-3,
          .col-4,
          .col-5,
          .col-6,
          .col-7,
          .col-8,
          .col-9,
          .col-10,
          .col-11,
          .col-12,
          .col,
          .col-auto,
          .col-sm-1,
          .col-sm-2,
          .col-sm-3,
          .col-sm-4,
          .col-sm-5,
          .col-sm-6,
          .col-sm-7,
          .col-sm-8,
          .col-sm-9,
          .col-sm-10,
          .col-sm-11,
          .col-sm-12,
          .col-sm,
          .col-sm-auto,
          .col-md-1,
          .col-md-2,
          .col-md-3,
          .col-md-4,
          .col-md-5,
          .col-md-6,
          .col-md-7,
          .col-md-8,
          .col-md-9,
          .col-md-10,
          .col-md-11,
          .col-md-12,
          .col-md,
          .col-md-auto,
          .col-lg-1,
          .col-lg-2,
          .col-lg-3,
          .col-lg-4,
          .col-lg-5,
          .col-lg-6,
          .col-lg-7,
          .col-lg-8,
          .col-lg-9,
          .col-lg-10,
          .col-lg-11,
          .col-lg-12,
          .col-lg,
          .col-lg-auto,
          .col-xl-1,
          .col-xl-2,
          .col-xl-3,
          .col-xl-4,
          .col-xl-5,
          .col-xl-6,
          .col-xl-7,
          .col-xl-8,
          .col-xl-9,
          .col-xl-10,
          .col-xl-11,
          .col-xl-12,
          .col-xl,
          .col-xl-auto
          position: relative;
          width: 100%;
          min-height: 1px;
          padding-right: 15px;
          padding-left: 15px;



          /* my css */

          .horizontal-scroll
          overflow-x: auto;
          -ms-flex-wrap: nowrap;
          flex-wrap: nowrap;


          .col-card
          max-width: 14%;


          .some-card
          height: 220px;
          font-size: 16px;
          text-align: center;
          padding-right: 5px;
          margin-top: 5px;
          -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          border-radius: 2px;
          background: #fff;
          margin-bottom: 20px;
          position: relative;
          border-top-style: solid;


          .flip-list-move
          transition: transform 1s;

          <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>

          <div id="app">
          <div class="row">
          <div class="container-fluid">
          <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
          <div class="col-xs-12 col-md-2 col-lg-2 col-card" v-for="(someCard, index) in someCards" v-bind:key="someCard.id">
          <div class="some-card" @click="changeOrder(someCard)">
          someCard.someTitle
          </div>
          </div>
          </transition-group>
          </div>
          </div>
          </div>





          JSFiddle






          share|improve this answer























          • This makes so much sens :) You're simply the best o/

            – manu
            Nov 14 '18 at 13:45











          • @manu Avec plaisir :)

            – Husam Ibrahim
            Nov 14 '18 at 13:56










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299573%2fvuejs-list-reorder-doesnt-trigger-transitions%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          3














          It's because you're using the index as a key. The index will always be the same for the same position even if the card changes. I'd give each card a unique id and then use that as a key instead ..






          new Vue(
          el: "#app",
          data:
          someCards: [
          id: 0,
          order: 2,
          someTitle: 'Title 1'
          ,

          id: 1,
          order: 2,
          someTitle: 'Title 2'
          ,

          id: 2,
          order: 2,
          someTitle: 'Title 3'
          ,

          id: 3,
          order: 3,
          someTitle: 'Title 4'
          ,

          id: 4,
          order: 3,
          someTitle: 'Title 5'
          ,

          id: 5,
          order: 1,
          someTitle: 'Title 6'
          ,

          id: 6,
          order: 1,
          someTitle: 'Title 7'
          ,

          id: 7,
          order: 1,
          someTitle: 'Title 8'
          ,

          id: 8,
          order: 3,
          someTitle: 'Title 1'

          ]
          ,
          methods:
          changeOrder(someCardData)
          let newRandom = Math.floor(Math.random() * 3) + 1;
          while (newRandom === someCardData.order)
          newRandom = Math.floor(Math.random() * 3) + 1;

          someCardData.order = newRandom;
          this.reorderList();
          ,
          reorderList()
          this.someCards.sort(function(objA, objB)
          return objA.order - objB.order;
          )
          ,

          )

          /* default */

          body
          background: #20262E;
          padding: 20px;
          font-family: Helvetica;


          #app
          background: #fff;
          border-radius: 4px;
          padding: 20px;
          transition: all 0.2s;



          /* bootstrap */

          .row
          display: -ms-flexbox;
          display: flex;
          -ms-flex-wrap: wrap;
          flex-wrap: wrap;
          margin-right: -15px;
          margin-left: -15px;


          .col-1,
          .col-2,
          .col-3,
          .col-4,
          .col-5,
          .col-6,
          .col-7,
          .col-8,
          .col-9,
          .col-10,
          .col-11,
          .col-12,
          .col,
          .col-auto,
          .col-sm-1,
          .col-sm-2,
          .col-sm-3,
          .col-sm-4,
          .col-sm-5,
          .col-sm-6,
          .col-sm-7,
          .col-sm-8,
          .col-sm-9,
          .col-sm-10,
          .col-sm-11,
          .col-sm-12,
          .col-sm,
          .col-sm-auto,
          .col-md-1,
          .col-md-2,
          .col-md-3,
          .col-md-4,
          .col-md-5,
          .col-md-6,
          .col-md-7,
          .col-md-8,
          .col-md-9,
          .col-md-10,
          .col-md-11,
          .col-md-12,
          .col-md,
          .col-md-auto,
          .col-lg-1,
          .col-lg-2,
          .col-lg-3,
          .col-lg-4,
          .col-lg-5,
          .col-lg-6,
          .col-lg-7,
          .col-lg-8,
          .col-lg-9,
          .col-lg-10,
          .col-lg-11,
          .col-lg-12,
          .col-lg,
          .col-lg-auto,
          .col-xl-1,
          .col-xl-2,
          .col-xl-3,
          .col-xl-4,
          .col-xl-5,
          .col-xl-6,
          .col-xl-7,
          .col-xl-8,
          .col-xl-9,
          .col-xl-10,
          .col-xl-11,
          .col-xl-12,
          .col-xl,
          .col-xl-auto
          position: relative;
          width: 100%;
          min-height: 1px;
          padding-right: 15px;
          padding-left: 15px;



          /* my css */

          .horizontal-scroll
          overflow-x: auto;
          -ms-flex-wrap: nowrap;
          flex-wrap: nowrap;


          .col-card
          max-width: 14%;


          .some-card
          height: 220px;
          font-size: 16px;
          text-align: center;
          padding-right: 5px;
          margin-top: 5px;
          -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          border-radius: 2px;
          background: #fff;
          margin-bottom: 20px;
          position: relative;
          border-top-style: solid;


          .flip-list-move
          transition: transform 1s;

          <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>

          <div id="app">
          <div class="row">
          <div class="container-fluid">
          <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
          <div class="col-xs-12 col-md-2 col-lg-2 col-card" v-for="(someCard, index) in someCards" v-bind:key="someCard.id">
          <div class="some-card" @click="changeOrder(someCard)">
          someCard.someTitle
          </div>
          </div>
          </transition-group>
          </div>
          </div>
          </div>





          JSFiddle






          share|improve this answer























          • This makes so much sens :) You're simply the best o/

            – manu
            Nov 14 '18 at 13:45











          • @manu Avec plaisir :)

            – Husam Ibrahim
            Nov 14 '18 at 13:56















          3














          It's because you're using the index as a key. The index will always be the same for the same position even if the card changes. I'd give each card a unique id and then use that as a key instead ..






          new Vue(
          el: "#app",
          data:
          someCards: [
          id: 0,
          order: 2,
          someTitle: 'Title 1'
          ,

          id: 1,
          order: 2,
          someTitle: 'Title 2'
          ,

          id: 2,
          order: 2,
          someTitle: 'Title 3'
          ,

          id: 3,
          order: 3,
          someTitle: 'Title 4'
          ,

          id: 4,
          order: 3,
          someTitle: 'Title 5'
          ,

          id: 5,
          order: 1,
          someTitle: 'Title 6'
          ,

          id: 6,
          order: 1,
          someTitle: 'Title 7'
          ,

          id: 7,
          order: 1,
          someTitle: 'Title 8'
          ,

          id: 8,
          order: 3,
          someTitle: 'Title 1'

          ]
          ,
          methods:
          changeOrder(someCardData)
          let newRandom = Math.floor(Math.random() * 3) + 1;
          while (newRandom === someCardData.order)
          newRandom = Math.floor(Math.random() * 3) + 1;

          someCardData.order = newRandom;
          this.reorderList();
          ,
          reorderList()
          this.someCards.sort(function(objA, objB)
          return objA.order - objB.order;
          )
          ,

          )

          /* default */

          body
          background: #20262E;
          padding: 20px;
          font-family: Helvetica;


          #app
          background: #fff;
          border-radius: 4px;
          padding: 20px;
          transition: all 0.2s;



          /* bootstrap */

          .row
          display: -ms-flexbox;
          display: flex;
          -ms-flex-wrap: wrap;
          flex-wrap: wrap;
          margin-right: -15px;
          margin-left: -15px;


          .col-1,
          .col-2,
          .col-3,
          .col-4,
          .col-5,
          .col-6,
          .col-7,
          .col-8,
          .col-9,
          .col-10,
          .col-11,
          .col-12,
          .col,
          .col-auto,
          .col-sm-1,
          .col-sm-2,
          .col-sm-3,
          .col-sm-4,
          .col-sm-5,
          .col-sm-6,
          .col-sm-7,
          .col-sm-8,
          .col-sm-9,
          .col-sm-10,
          .col-sm-11,
          .col-sm-12,
          .col-sm,
          .col-sm-auto,
          .col-md-1,
          .col-md-2,
          .col-md-3,
          .col-md-4,
          .col-md-5,
          .col-md-6,
          .col-md-7,
          .col-md-8,
          .col-md-9,
          .col-md-10,
          .col-md-11,
          .col-md-12,
          .col-md,
          .col-md-auto,
          .col-lg-1,
          .col-lg-2,
          .col-lg-3,
          .col-lg-4,
          .col-lg-5,
          .col-lg-6,
          .col-lg-7,
          .col-lg-8,
          .col-lg-9,
          .col-lg-10,
          .col-lg-11,
          .col-lg-12,
          .col-lg,
          .col-lg-auto,
          .col-xl-1,
          .col-xl-2,
          .col-xl-3,
          .col-xl-4,
          .col-xl-5,
          .col-xl-6,
          .col-xl-7,
          .col-xl-8,
          .col-xl-9,
          .col-xl-10,
          .col-xl-11,
          .col-xl-12,
          .col-xl,
          .col-xl-auto
          position: relative;
          width: 100%;
          min-height: 1px;
          padding-right: 15px;
          padding-left: 15px;



          /* my css */

          .horizontal-scroll
          overflow-x: auto;
          -ms-flex-wrap: nowrap;
          flex-wrap: nowrap;


          .col-card
          max-width: 14%;


          .some-card
          height: 220px;
          font-size: 16px;
          text-align: center;
          padding-right: 5px;
          margin-top: 5px;
          -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          border-radius: 2px;
          background: #fff;
          margin-bottom: 20px;
          position: relative;
          border-top-style: solid;


          .flip-list-move
          transition: transform 1s;

          <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>

          <div id="app">
          <div class="row">
          <div class="container-fluid">
          <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
          <div class="col-xs-12 col-md-2 col-lg-2 col-card" v-for="(someCard, index) in someCards" v-bind:key="someCard.id">
          <div class="some-card" @click="changeOrder(someCard)">
          someCard.someTitle
          </div>
          </div>
          </transition-group>
          </div>
          </div>
          </div>





          JSFiddle






          share|improve this answer























          • This makes so much sens :) You're simply the best o/

            – manu
            Nov 14 '18 at 13:45











          • @manu Avec plaisir :)

            – Husam Ibrahim
            Nov 14 '18 at 13:56













          3












          3








          3







          It's because you're using the index as a key. The index will always be the same for the same position even if the card changes. I'd give each card a unique id and then use that as a key instead ..






          new Vue(
          el: "#app",
          data:
          someCards: [
          id: 0,
          order: 2,
          someTitle: 'Title 1'
          ,

          id: 1,
          order: 2,
          someTitle: 'Title 2'
          ,

          id: 2,
          order: 2,
          someTitle: 'Title 3'
          ,

          id: 3,
          order: 3,
          someTitle: 'Title 4'
          ,

          id: 4,
          order: 3,
          someTitle: 'Title 5'
          ,

          id: 5,
          order: 1,
          someTitle: 'Title 6'
          ,

          id: 6,
          order: 1,
          someTitle: 'Title 7'
          ,

          id: 7,
          order: 1,
          someTitle: 'Title 8'
          ,

          id: 8,
          order: 3,
          someTitle: 'Title 1'

          ]
          ,
          methods:
          changeOrder(someCardData)
          let newRandom = Math.floor(Math.random() * 3) + 1;
          while (newRandom === someCardData.order)
          newRandom = Math.floor(Math.random() * 3) + 1;

          someCardData.order = newRandom;
          this.reorderList();
          ,
          reorderList()
          this.someCards.sort(function(objA, objB)
          return objA.order - objB.order;
          )
          ,

          )

          /* default */

          body
          background: #20262E;
          padding: 20px;
          font-family: Helvetica;


          #app
          background: #fff;
          border-radius: 4px;
          padding: 20px;
          transition: all 0.2s;



          /* bootstrap */

          .row
          display: -ms-flexbox;
          display: flex;
          -ms-flex-wrap: wrap;
          flex-wrap: wrap;
          margin-right: -15px;
          margin-left: -15px;


          .col-1,
          .col-2,
          .col-3,
          .col-4,
          .col-5,
          .col-6,
          .col-7,
          .col-8,
          .col-9,
          .col-10,
          .col-11,
          .col-12,
          .col,
          .col-auto,
          .col-sm-1,
          .col-sm-2,
          .col-sm-3,
          .col-sm-4,
          .col-sm-5,
          .col-sm-6,
          .col-sm-7,
          .col-sm-8,
          .col-sm-9,
          .col-sm-10,
          .col-sm-11,
          .col-sm-12,
          .col-sm,
          .col-sm-auto,
          .col-md-1,
          .col-md-2,
          .col-md-3,
          .col-md-4,
          .col-md-5,
          .col-md-6,
          .col-md-7,
          .col-md-8,
          .col-md-9,
          .col-md-10,
          .col-md-11,
          .col-md-12,
          .col-md,
          .col-md-auto,
          .col-lg-1,
          .col-lg-2,
          .col-lg-3,
          .col-lg-4,
          .col-lg-5,
          .col-lg-6,
          .col-lg-7,
          .col-lg-8,
          .col-lg-9,
          .col-lg-10,
          .col-lg-11,
          .col-lg-12,
          .col-lg,
          .col-lg-auto,
          .col-xl-1,
          .col-xl-2,
          .col-xl-3,
          .col-xl-4,
          .col-xl-5,
          .col-xl-6,
          .col-xl-7,
          .col-xl-8,
          .col-xl-9,
          .col-xl-10,
          .col-xl-11,
          .col-xl-12,
          .col-xl,
          .col-xl-auto
          position: relative;
          width: 100%;
          min-height: 1px;
          padding-right: 15px;
          padding-left: 15px;



          /* my css */

          .horizontal-scroll
          overflow-x: auto;
          -ms-flex-wrap: nowrap;
          flex-wrap: nowrap;


          .col-card
          max-width: 14%;


          .some-card
          height: 220px;
          font-size: 16px;
          text-align: center;
          padding-right: 5px;
          margin-top: 5px;
          -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          border-radius: 2px;
          background: #fff;
          margin-bottom: 20px;
          position: relative;
          border-top-style: solid;


          .flip-list-move
          transition: transform 1s;

          <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>

          <div id="app">
          <div class="row">
          <div class="container-fluid">
          <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
          <div class="col-xs-12 col-md-2 col-lg-2 col-card" v-for="(someCard, index) in someCards" v-bind:key="someCard.id">
          <div class="some-card" @click="changeOrder(someCard)">
          someCard.someTitle
          </div>
          </div>
          </transition-group>
          </div>
          </div>
          </div>





          JSFiddle






          share|improve this answer













          It's because you're using the index as a key. The index will always be the same for the same position even if the card changes. I'd give each card a unique id and then use that as a key instead ..






          new Vue(
          el: "#app",
          data:
          someCards: [
          id: 0,
          order: 2,
          someTitle: 'Title 1'
          ,

          id: 1,
          order: 2,
          someTitle: 'Title 2'
          ,

          id: 2,
          order: 2,
          someTitle: 'Title 3'
          ,

          id: 3,
          order: 3,
          someTitle: 'Title 4'
          ,

          id: 4,
          order: 3,
          someTitle: 'Title 5'
          ,

          id: 5,
          order: 1,
          someTitle: 'Title 6'
          ,

          id: 6,
          order: 1,
          someTitle: 'Title 7'
          ,

          id: 7,
          order: 1,
          someTitle: 'Title 8'
          ,

          id: 8,
          order: 3,
          someTitle: 'Title 1'

          ]
          ,
          methods:
          changeOrder(someCardData)
          let newRandom = Math.floor(Math.random() * 3) + 1;
          while (newRandom === someCardData.order)
          newRandom = Math.floor(Math.random() * 3) + 1;

          someCardData.order = newRandom;
          this.reorderList();
          ,
          reorderList()
          this.someCards.sort(function(objA, objB)
          return objA.order - objB.order;
          )
          ,

          )

          /* default */

          body
          background: #20262E;
          padding: 20px;
          font-family: Helvetica;


          #app
          background: #fff;
          border-radius: 4px;
          padding: 20px;
          transition: all 0.2s;



          /* bootstrap */

          .row
          display: -ms-flexbox;
          display: flex;
          -ms-flex-wrap: wrap;
          flex-wrap: wrap;
          margin-right: -15px;
          margin-left: -15px;


          .col-1,
          .col-2,
          .col-3,
          .col-4,
          .col-5,
          .col-6,
          .col-7,
          .col-8,
          .col-9,
          .col-10,
          .col-11,
          .col-12,
          .col,
          .col-auto,
          .col-sm-1,
          .col-sm-2,
          .col-sm-3,
          .col-sm-4,
          .col-sm-5,
          .col-sm-6,
          .col-sm-7,
          .col-sm-8,
          .col-sm-9,
          .col-sm-10,
          .col-sm-11,
          .col-sm-12,
          .col-sm,
          .col-sm-auto,
          .col-md-1,
          .col-md-2,
          .col-md-3,
          .col-md-4,
          .col-md-5,
          .col-md-6,
          .col-md-7,
          .col-md-8,
          .col-md-9,
          .col-md-10,
          .col-md-11,
          .col-md-12,
          .col-md,
          .col-md-auto,
          .col-lg-1,
          .col-lg-2,
          .col-lg-3,
          .col-lg-4,
          .col-lg-5,
          .col-lg-6,
          .col-lg-7,
          .col-lg-8,
          .col-lg-9,
          .col-lg-10,
          .col-lg-11,
          .col-lg-12,
          .col-lg,
          .col-lg-auto,
          .col-xl-1,
          .col-xl-2,
          .col-xl-3,
          .col-xl-4,
          .col-xl-5,
          .col-xl-6,
          .col-xl-7,
          .col-xl-8,
          .col-xl-9,
          .col-xl-10,
          .col-xl-11,
          .col-xl-12,
          .col-xl,
          .col-xl-auto
          position: relative;
          width: 100%;
          min-height: 1px;
          padding-right: 15px;
          padding-left: 15px;



          /* my css */

          .horizontal-scroll
          overflow-x: auto;
          -ms-flex-wrap: nowrap;
          flex-wrap: nowrap;


          .col-card
          max-width: 14%;


          .some-card
          height: 220px;
          font-size: 16px;
          text-align: center;
          padding-right: 5px;
          margin-top: 5px;
          -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          border-radius: 2px;
          background: #fff;
          margin-bottom: 20px;
          position: relative;
          border-top-style: solid;


          .flip-list-move
          transition: transform 1s;

          <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>

          <div id="app">
          <div class="row">
          <div class="container-fluid">
          <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
          <div class="col-xs-12 col-md-2 col-lg-2 col-card" v-for="(someCard, index) in someCards" v-bind:key="someCard.id">
          <div class="some-card" @click="changeOrder(someCard)">
          someCard.someTitle
          </div>
          </div>
          </transition-group>
          </div>
          </div>
          </div>





          JSFiddle






          new Vue(
          el: "#app",
          data:
          someCards: [
          id: 0,
          order: 2,
          someTitle: 'Title 1'
          ,

          id: 1,
          order: 2,
          someTitle: 'Title 2'
          ,

          id: 2,
          order: 2,
          someTitle: 'Title 3'
          ,

          id: 3,
          order: 3,
          someTitle: 'Title 4'
          ,

          id: 4,
          order: 3,
          someTitle: 'Title 5'
          ,

          id: 5,
          order: 1,
          someTitle: 'Title 6'
          ,

          id: 6,
          order: 1,
          someTitle: 'Title 7'
          ,

          id: 7,
          order: 1,
          someTitle: 'Title 8'
          ,

          id: 8,
          order: 3,
          someTitle: 'Title 1'

          ]
          ,
          methods:
          changeOrder(someCardData)
          let newRandom = Math.floor(Math.random() * 3) + 1;
          while (newRandom === someCardData.order)
          newRandom = Math.floor(Math.random() * 3) + 1;

          someCardData.order = newRandom;
          this.reorderList();
          ,
          reorderList()
          this.someCards.sort(function(objA, objB)
          return objA.order - objB.order;
          )
          ,

          )

          /* default */

          body
          background: #20262E;
          padding: 20px;
          font-family: Helvetica;


          #app
          background: #fff;
          border-radius: 4px;
          padding: 20px;
          transition: all 0.2s;



          /* bootstrap */

          .row
          display: -ms-flexbox;
          display: flex;
          -ms-flex-wrap: wrap;
          flex-wrap: wrap;
          margin-right: -15px;
          margin-left: -15px;


          .col-1,
          .col-2,
          .col-3,
          .col-4,
          .col-5,
          .col-6,
          .col-7,
          .col-8,
          .col-9,
          .col-10,
          .col-11,
          .col-12,
          .col,
          .col-auto,
          .col-sm-1,
          .col-sm-2,
          .col-sm-3,
          .col-sm-4,
          .col-sm-5,
          .col-sm-6,
          .col-sm-7,
          .col-sm-8,
          .col-sm-9,
          .col-sm-10,
          .col-sm-11,
          .col-sm-12,
          .col-sm,
          .col-sm-auto,
          .col-md-1,
          .col-md-2,
          .col-md-3,
          .col-md-4,
          .col-md-5,
          .col-md-6,
          .col-md-7,
          .col-md-8,
          .col-md-9,
          .col-md-10,
          .col-md-11,
          .col-md-12,
          .col-md,
          .col-md-auto,
          .col-lg-1,
          .col-lg-2,
          .col-lg-3,
          .col-lg-4,
          .col-lg-5,
          .col-lg-6,
          .col-lg-7,
          .col-lg-8,
          .col-lg-9,
          .col-lg-10,
          .col-lg-11,
          .col-lg-12,
          .col-lg,
          .col-lg-auto,
          .col-xl-1,
          .col-xl-2,
          .col-xl-3,
          .col-xl-4,
          .col-xl-5,
          .col-xl-6,
          .col-xl-7,
          .col-xl-8,
          .col-xl-9,
          .col-xl-10,
          .col-xl-11,
          .col-xl-12,
          .col-xl,
          .col-xl-auto
          position: relative;
          width: 100%;
          min-height: 1px;
          padding-right: 15px;
          padding-left: 15px;



          /* my css */

          .horizontal-scroll
          overflow-x: auto;
          -ms-flex-wrap: nowrap;
          flex-wrap: nowrap;


          .col-card
          max-width: 14%;


          .some-card
          height: 220px;
          font-size: 16px;
          text-align: center;
          padding-right: 5px;
          margin-top: 5px;
          -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          border-radius: 2px;
          background: #fff;
          margin-bottom: 20px;
          position: relative;
          border-top-style: solid;


          .flip-list-move
          transition: transform 1s;

          <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>

          <div id="app">
          <div class="row">
          <div class="container-fluid">
          <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
          <div class="col-xs-12 col-md-2 col-lg-2 col-card" v-for="(someCard, index) in someCards" v-bind:key="someCard.id">
          <div class="some-card" @click="changeOrder(someCard)">
          someCard.someTitle
          </div>
          </div>
          </transition-group>
          </div>
          </div>
          </div>





          new Vue(
          el: "#app",
          data:
          someCards: [
          id: 0,
          order: 2,
          someTitle: 'Title 1'
          ,

          id: 1,
          order: 2,
          someTitle: 'Title 2'
          ,

          id: 2,
          order: 2,
          someTitle: 'Title 3'
          ,

          id: 3,
          order: 3,
          someTitle: 'Title 4'
          ,

          id: 4,
          order: 3,
          someTitle: 'Title 5'
          ,

          id: 5,
          order: 1,
          someTitle: 'Title 6'
          ,

          id: 6,
          order: 1,
          someTitle: 'Title 7'
          ,

          id: 7,
          order: 1,
          someTitle: 'Title 8'
          ,

          id: 8,
          order: 3,
          someTitle: 'Title 1'

          ]
          ,
          methods:
          changeOrder(someCardData)
          let newRandom = Math.floor(Math.random() * 3) + 1;
          while (newRandom === someCardData.order)
          newRandom = Math.floor(Math.random() * 3) + 1;

          someCardData.order = newRandom;
          this.reorderList();
          ,
          reorderList()
          this.someCards.sort(function(objA, objB)
          return objA.order - objB.order;
          )
          ,

          )

          /* default */

          body
          background: #20262E;
          padding: 20px;
          font-family: Helvetica;


          #app
          background: #fff;
          border-radius: 4px;
          padding: 20px;
          transition: all 0.2s;



          /* bootstrap */

          .row
          display: -ms-flexbox;
          display: flex;
          -ms-flex-wrap: wrap;
          flex-wrap: wrap;
          margin-right: -15px;
          margin-left: -15px;


          .col-1,
          .col-2,
          .col-3,
          .col-4,
          .col-5,
          .col-6,
          .col-7,
          .col-8,
          .col-9,
          .col-10,
          .col-11,
          .col-12,
          .col,
          .col-auto,
          .col-sm-1,
          .col-sm-2,
          .col-sm-3,
          .col-sm-4,
          .col-sm-5,
          .col-sm-6,
          .col-sm-7,
          .col-sm-8,
          .col-sm-9,
          .col-sm-10,
          .col-sm-11,
          .col-sm-12,
          .col-sm,
          .col-sm-auto,
          .col-md-1,
          .col-md-2,
          .col-md-3,
          .col-md-4,
          .col-md-5,
          .col-md-6,
          .col-md-7,
          .col-md-8,
          .col-md-9,
          .col-md-10,
          .col-md-11,
          .col-md-12,
          .col-md,
          .col-md-auto,
          .col-lg-1,
          .col-lg-2,
          .col-lg-3,
          .col-lg-4,
          .col-lg-5,
          .col-lg-6,
          .col-lg-7,
          .col-lg-8,
          .col-lg-9,
          .col-lg-10,
          .col-lg-11,
          .col-lg-12,
          .col-lg,
          .col-lg-auto,
          .col-xl-1,
          .col-xl-2,
          .col-xl-3,
          .col-xl-4,
          .col-xl-5,
          .col-xl-6,
          .col-xl-7,
          .col-xl-8,
          .col-xl-9,
          .col-xl-10,
          .col-xl-11,
          .col-xl-12,
          .col-xl,
          .col-xl-auto
          position: relative;
          width: 100%;
          min-height: 1px;
          padding-right: 15px;
          padding-left: 15px;



          /* my css */

          .horizontal-scroll
          overflow-x: auto;
          -ms-flex-wrap: nowrap;
          flex-wrap: nowrap;


          .col-card
          max-width: 14%;


          .some-card
          height: 220px;
          font-size: 16px;
          text-align: center;
          padding-right: 5px;
          margin-top: 5px;
          -webkit-box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          box-shadow: 1px 1px 5px rgba(0, 0, 0, .1);
          border-radius: 2px;
          background: #fff;
          margin-bottom: 20px;
          position: relative;
          border-top-style: solid;


          .flip-list-move
          transition: transform 1s;

          <script src="https://cdn.jsdelivr.net/npm/vue@2.5.17/dist/vue.js"></script>

          <div id="app">
          <div class="row">
          <div class="container-fluid">
          <transition-group name="flip-list" tag="div" class="row horizontal-scroll">
          <div class="col-xs-12 col-md-2 col-lg-2 col-card" v-for="(someCard, index) in someCards" v-bind:key="someCard.id">
          <div class="some-card" @click="changeOrder(someCard)">
          someCard.someTitle
          </div>
          </div>
          </transition-group>
          </div>
          </div>
          </div>






          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 14 '18 at 13:32









          Husam IbrahimHusam Ibrahim

          3,323417




          3,323417












          • This makes so much sens :) You're simply the best o/

            – manu
            Nov 14 '18 at 13:45











          • @manu Avec plaisir :)

            – Husam Ibrahim
            Nov 14 '18 at 13:56

















          • This makes so much sens :) You're simply the best o/

            – manu
            Nov 14 '18 at 13:45











          • @manu Avec plaisir :)

            – Husam Ibrahim
            Nov 14 '18 at 13:56
















          This makes so much sens :) You're simply the best o/

          – manu
          Nov 14 '18 at 13:45





          This makes so much sens :) You're simply the best o/

          – manu
          Nov 14 '18 at 13:45













          @manu Avec plaisir :)

          – Husam Ibrahim
          Nov 14 '18 at 13:56





          @manu Avec plaisir :)

          – Husam Ibrahim
          Nov 14 '18 at 13:56



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53299573%2fvuejs-list-reorder-doesnt-trigger-transitions%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          How to how show current date and time by default on contact form 7 in WordPress without taking input from user in datetimepicker

          Syphilis

          Darth Vader #20