0👍
This is more of a javascript problem than a vuejs problem. You would want to sort the array before displaying it.
after declaring the array you can run this sort snippet.
quiz.questions.sort((a, b) => a.text.localeCompare(b.text));
quiz.questions.forEach(({ responses }) => responses.sort((a, b) => a.text.localeCompare(b.text)));
What this does is to sort the outer “object” while using the key (text) in ascending order, once the outer object has been sorted, you loop through the responses array inside the object to sort each object using the key(text) in ascending order.
- [Vuejs]-Vue.js app with Firebase realtime database and VueFire suddenly stopped working
- [Vuejs]-I want to display message with v-model but it does not working
Source:stackexchange.com