How does vue return the corresponding value?

< div class= "a" data-id="0" > {{state}} < / div >
< div class= "a" data-id="1" > {{state}} < / div >
< div class= "a" data-id="2" > {{state}} < / div >
0 Shipping 1 has been shipped 2 refund

div is looped out of the background data. How to return the corresponding value to the current state.
how to say. That"s how js used to be.
var arr= ["to be shipped", "shipped", "refund"]
arr [{{state}}], what does it say in vue?

Sep.17,2021

list = [
{value: 0, label: 'shipping'},
{value: 1, label: 'shipped'},
{value: 2, label: 'refund'}
]

use v-for to traverse this list, to generate div
< div v talk for = "item of list" class= "a": data-id='item.value': key= "item.value" > {{item.label}} < / div >

you can try. I don't know if you said "return the corresponding value"

.

I see what you mean. We usually use Filter, a Filter function, {{state | stateFilter}} function
to write Filter function
stateFilter (val) {

in fileter.
const arr=[''];
return arr[val];

}

Menu