vue for each循环出来数组的某一项 再重新合并成一个新数组
search() {
request
.get("/manager")
.then(res => {
if (res.code == 20000) {
this.tableData = res.data.list;
var categorystr = ''
var classifystr = ''
this.tableData.forEach(function(c) {
categorystr += c.category + ","
classifystr += c.classify + ","
});
categorystr = categorystr.substring(0,categorystr.length-1)
classifystr = classifystr.substring(0,classifystr.length-1)
this.categoryList = categorystr.split(",")
this.classifystr = classifystr.split(",")
// console.log(str)
// console.log(this.categoryList)
}
})
.catch(err => {
console.log(err);
});
![](https://img2018.cnblogs.com/i-beta/1422761/201912/1422761-20191210105630257-444947495.png)
不求大富大贵,但求一生平凡