I have an array of objects: {2buret"Li Si", 1V "Zhang San", 3R "Wang Wu"}, and I want to output them in this order.
if you use v-for to traverse, the output will be as follows: {1 ASCII "Zhang San", 2 ASCII"Li Si", 3 ASCII "Wang Wu"}
I just want to add indexes to implement the function. {1: {2: Li Si}, 2: {1: Zhang San}, 3: {3: Wang Wu}
but this requires a lot of code changes.
is there a more elegant way to modify the rendering order of v-for?
(check the document above, but Baidu can"t find a solution)
can only customize filters? But the filter is equivalent to being sequentially bound to a specific array. Cannot be decoupled.
also hope for advice!
I thought for a moment whether I could encapsulate a filter function.
pass in a "fixed array of objects" each time, and then this function, through pop,shift or something, returns the desired result.
so you can reuse it. Although it is troublesome to write functions, it will be convenient in the future.
thanks to the above two friends for their advice.