diff --git a/src/pages/notice/[id].vue b/src/pages/notice/[id].vue index ce1c631..9429386 100644 --- a/src/pages/notice/[id].vue +++ b/src/pages/notice/[id].vue @@ -31,6 +31,7 @@ export default { data() { return { page: null, + fileAttached:false, files: [], isLoading: true } @@ -40,27 +41,18 @@ export default { .then(response => response.json()) .then(data => { this.page = data.data - let attIDs = '' - let t = 0 - this.page[0].attachments.forEach(ids => { - if (t == 0) attIDs = ids - else attIDs = attIDs + ',' + ids - t++ - // console.log(ids) - }); - // console.log(attIDs) - // this.getAttachments(this.page[0].attachments) - // console.log(this.page[0].attachments) this.isLoading = false - fetch('https://api8.siliconpin.com/items/scc22_files_1?filter[id][_in]=' + attIDs) + fetch('https://api8.siliconpin.com/items/scc22_files_1?filter[scc22_id][_in]=' + this.page[0].id) .then(resp => resp.json()) .then(file => { this.files = file.data + this.fileAttached=true // attach.data.forEach(fileID=> this.files.push(fileID.directus_files_id)) console.log(file.data) // this.attachments.push(attach.data[0].directus_files_id) }) + if(fileAttached) // console.log(Object.assign({}, this.files)) // console.log(this.files) })