After successfully viewing the image, I encountered an error when trying to navigate back using
<NuxtLink :to="{ path: 'About', hash: '#secondNav' }" class="close">
, which resulted in a message stating Cannot find module './undefined.jpg'
"<template>
<div class="container-fluid imgBackground vh-100">
<div class="imgCont">
<NuxtLink :to="{ path: 'About', hash: '#secondNav' }" class="close">
<img
id="closeImg"
src="@/assets/images/closeHover.png"
src2="@/assets/images/close.png"
/>
</NuxtLink>
<img
class="img-fluid"
:src="imageUrl.myImg"
alt="Sarah Project Image"
/>
</div>
</div>
</template>
<script>
export default {
computed: {
imageUrl() {
return {
myImg: require(`@/assets/images/gallery/${this.$route.params.img}.jpg`)
};
}
}
};
</script>