JSFiddle - React, Tailwind, and code Playground
by jury1
HTML
<div id="app">
<button @click="onClick">click me</button>
<bullshit :value="value +1"></bullshit>
<bullshit :value="value / 2"></bullshit>
</div>
CSS
.value-enter-active,
.value-leave-active {
transition: opacity 0.5s ease;
}
.value-enter,
.value-leave-to {
opacity: 0;
}
Vue
Vue.component('bullshit', {
props: [ 'value' ],
template: `
<transition mode="out-in" name="value">
<div :key="value">{{ value }}</div>
</transition>`
});
new Vue({
el: '#app',
data: {
value: 0,
},
methods: {
onClick() {
this.value = Math.random() * 1000 | 0;
},
},
});