我想追加从后端获得的值。例如:
// Initially
var x = '';
// on choosing first filter
x = v.state; (v.state value changes each time when filter is choosen, I want to append all the filter values choosen)
// output expected
x = firstFilter + '+' + secondFilter
现在我需要将所有过滤器值连接到“+”
答案 0 :(得分:0)
构建一个数组并使用join
运算符来拼接元素" +"
// Initially
var x = [];
// on choosing first filter
x.push("A^B");
// on choosing second filter
x.push("C^D");
// output expected
console.log(x.join(" + "))
// A^B + C^D