Vue how does an array contain a variable?

clipboard.png

above is the effect I want, where 10 and 3 are variables.
I tried this and showed underfine

return{
    list_tabs:["" + this.people_reply],
    people_reply:10, //
    people_none:3, //
}

tried string concatenation of ES6, but it didn"t work

list_tabs:["`${people_reply}`"],

how to solve a situation like this?

Nov.15,2021

list_tabs should be placed in the computed of vue, not in data.


 list_tabs:["" + people_reply],
    people_reply:10, //
    people_none:3, //

Why don't you write that?


list_tabs: ["answered" + this.people_reply], no, because it doesn't know this.people_reply exists when this code takes effect.
list_tabs: [" answered ${people_reply} "] this is called a template string, and the correct way to write it is without double quotation marks. Also make sure that people_reply exists.
it is recommended that you put list_tabs in computed.


you spelled it wrong. Es6 string concatenation should be like this

list_tabs:[`${people_reply}`],

Why not define a variable outside the array and put it in

Menu