How i can create a dynamic image gallery?
Open
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 1.5k
- Forks
- 331
- Avg merge
- 19h 52m
- Merged PRs (30d)
- 9
Description
Hello! I'm trying to create a portfolio that imports all images from a specific folder, which is ~/static/images
How can i do that? i have this code:
<template>
<div class="columns is-multiline">
<nuxt-img
v-for="image in images"
:src="image"
/>
</div>
</template>
<script>
export default {
name: 'imageGallery',
computed: {
images () {
const path = require.context('~/static/images', false, /\.jpg$/)
return path.keys().map(path)
}
}
}
</script>
and the image placehodlers appears, but none of the image are loaded.
console:

Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the gallery using the ~/static/images folder and the NuxtImg component with the require.context setup shown in the issue. Start by checking the reported browser-console error and whether the generated image paths resolve. Done means the images from the folder load in the gallery without placeholder errors.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nuxtjs
- Domain
- frontend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100