Commit 295f0f20 by lp784568205

修改数组排序方式

parent 41d7a0e3
......@@ -998,15 +998,27 @@ export default {
axios.get(`JsonData/CODE_AJXZ.json`).then((response) => {
if (response.success === true) {
this.laData = response.data.rows.filter((val) => {
return val.parentId == `${this.ajzlb}0000`;
});
response.data.rows.map((item) => {
this.laData.forEach((good) => {
if (good.parentId == item.id) {
this.laData.push(good);
}
});
if (val.id.indexOf(this.ajzlb, 0) == 0) {
return val;
}
});
// response.data.rows.map((item) => {
// this.laData.forEach((good) => {
// if (good.id == item.parentId) {
// this.laData.push(item);
// }
// });
// });
console.log(this.laData);
function compare(id) {
return function (a, b) {
var value1 = a[id];
var value2 = b[id];
return value1 - value2;
};
}
this.laData.sort(compare("id"));
this.parentLb.id = this.ajxzlb;
}
});
......@@ -1193,6 +1205,7 @@ export default {
array[1];
},
shrHighlight(val) {
debugger
var array = this.jyaq.split(val);
this.jyaq =
array[0] +
......@@ -1437,10 +1450,11 @@ export default {
response.data.rows.map((item) => {
this.laData.forEach((good) => {
if (good.id == item.parentId) {
this.laData.push(item);
// this.laData.push(item);
}
});
});
console.log(this.laData);
}
});
axios.get(`JsonData/CODE_AJXLB.json`).then((response) => {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment