api attachment

s2
Kar 2022-11-05 12:50:05 +05:30
parent 3552a1174e
commit 5349e735bf
1 changed files with 25 additions and 3 deletions

View File

@ -9,7 +9,7 @@
</div>
<div v-if="page[0].attachments">
<div v-html="page[0].attachments[0]"> </div>
<div v-html="page[0].attachments"> </div>
</div>
<div>{{page[0].attachments[0]}}</div>
@ -22,6 +22,7 @@
data() {
return {
page: null,
attachments:[],
isLoading: true
}
},
@ -31,9 +32,30 @@
.then(response => response.json())
.then(data => {
this.page = data.data
console.log(data)
this.page[0].attachments.forEach(element => {
fetch('https://api8.siliconpin.com/items/scc22_files_1?filter[id][_eq]='+element )
.then(response => response.json())
.then(attach => {
console.log(attach.data[0].directus_files_id)
this.attachments.push(attach.data[0].directus_files_id)
})
console.log(element)
});
// this.getAttachments(this.page[0].attachments)
// console.log(this.page[0].attachments)
this.isLoading = false
})
}
},
methods: {
// getAttachments(att) {
// console.log(att)
// // fetch('https://api8.siliconpin.com/items/ecom55?filter[slug][_eq]=' + this.$route.params.id)
// // .then(response => response.json())
// // .then(data => this.itemByCategory = data)
// // console.log(this.itemByCategory)
// }
}
}
</script>