Vue.js proper random ordering of v-for loop
问题 Have a list that i want to output in random order. I achieved this with computed property: <div id="app"> <ul> <li v-for="list in randomList" > {{ list.text }} </li> </ul> </div> <script> var vm = new Vue({ el:'#app', data:{ lists:[ {text:'js',value:'one'}, {text:'css',value:'two'}, {text:'html',value:'three'} ] }, computed: { randomList: function(){ return this.lists.sort(function(){return 0.5 - Math.random()}); } } }); </script> But if i have more than one list i that want to simplify this