preventing Vue from aggresively reusing dom-elements preventing Vue from aggresively reusing dom-elements vue.js vue.js

preventing Vue from aggresively reusing dom-elements


In cases such as this, Vue uses a special key attribute that tells it not to reuse the same element. Give each element this attribute with a unique value, and Vue will no longer reuse the same element:

<div v-if="tryIsMobile"     class="device device-mobile-portrait"     :class="deviceClass"     key="mobile">    ...</div><div v-else     class="device device-tablet-landscape"     :class="deviceClass"     key="tablet">    ...</div>