'Vue loop through assets directory images
So In my assets directory I have this structure
assets/
tests/
@id_story1/
test1/
1.png
2.png
I'm using json-server to fake a rest API and I'm using axios to retrieve information about each tests including the images path (example refpath direct me to the test1 folder)
Now I'm trying to loop through the test assets folder and display the images of the test
Here's my code so far : (this page is dynamically rendered after the user clicks on a dynamic path)
<template>
<v-app>
<app-navbar />
<v-main>
<h3>test {{$route.params.name}}, {{$route.query.status}},{{$route.query.tag}}</h3>
<h3>{{items[0].refpath}}</h3>
</v-main>
</v-app>
</template>
<script>
import appNavbar from '../../../components/appNavbar.vue';
import axios from "axios";
export default {
components : {appNavbar},
name: "App",
data() {
return {
items: [],
};
},
async created() {
try {
const res = await axios.get(`http://localhost:3004/tests`,{ params: {name:this.$route.params.name} });
this.items = res.data;
} catch (error) {
console.log(error);
}
},
};
</script>
<style lang="scss" scoped>
</style>
how can i loop through the images of the assets folder and display them ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
