Skip to content
Snippets Groups Projects
Commit ae4d5541 authored by 조 지현's avatar 조 지현
Browse files

getTable replace .forEach to for...of

parent ce265d53
No related branches found
No related tags found
No related merge requests found
...@@ -14,13 +14,15 @@ export default { ...@@ -14,13 +14,15 @@ export default {
// 파이프라인 리스트 호출한 결과값을 data 파일에 저장 // 파이프라인 리스트 호출한 결과값을 data 파일에 저장
this.pipelineList = (await pipeline()).data.data; this.pipelineList = (await pipeline()).data.data;
// 유아이 추출할때 사용할 코드 // 필터 유아이 추출할때 사용할 코드
// 데이터 파일 list 에 map 을 돌려서 그 안에 key 값을 추출 // 데이터 파일 list 에 map 을 돌려서 그 안에 key 값을 추출
// map object 형으로 한번에 추출하기 // map object 형으로 한번에 추출하기
const getName = this.pipelineList.map((item)=>item.name); // const getName = this.pipelineList.map((item)=>item.name);
console.log(getName); // console.log(getName);
const getKey = this.pipelineList.map((item)=>item.key); // const getKey = this.pipelineList.map((item)=>item.key);
console.log(getKey) // console.log(getKey)
const [names, keys] = this.pipelineList.map(item => [item.name, item.key]);
console.log(names, keys)
...@@ -28,15 +30,14 @@ export default { ...@@ -28,15 +30,14 @@ export default {
}, },
async getTable(){ async getTable(){
// pipelineList 에서 key 값을 뽑아내서 // pipelineList 에서 key 값을 뽑아내서
this.pipelineList.map((item)=>item.key) // 이터레이터 문법 for ... of 사용
// key 를 넣어 매치시켜 불러온 table data 를 response 에 받음 for (const pipelineKey of this.pipelineList.map((item) => item.key)) {
.forEach(async (pipelineKey) => { const response = (await table(pipelineKey)).data.data
const response = (await table(pipelineKey)).data.data // 테이블 배열을 1차원으로 정렬해준다.
// 테이블 배열을 1차원으로 정렬해준다. response.forEach(item => this.tableList.push(item))
response.forEach(item => this.tableList.push(item)) // 테이블 배열을 2차원으로 정렬한다.
// 테이블 배열을 2차원으로 정렬한다. // this.tableList.push(response)
// this.tableList.push(response) }
})
} }
}, },
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment