Suppose I have three divs - A, B, and c - and I want to change their order when a user clicks "reorder". Eg, by putting B first, C second, and A third. What is the cleanest way to do this in Vue?
Edit: in reality, there is a lot of content in the divs, so doing something like { divs: ['A', 'B', 'C'] }
with a v-for
would get too messy.
let app = new Vue({
el: '#app',
methods: {
reorder: function () {
},
},
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>
<div id="app">
<div>A</div>
<div>B</div>
<div>c</div>
<button v-on:click="reorder()">Reorder</button>
</div>