Answer the question
In order to leave comments, you need to log in
Answer the question
In order to leave comments, you need to log in
<template>
<div>
<div v-for="(image, index) in images" :key="index">
<img :src="image_url(image)" >
</div>
</div>
</template>
<script>
export default {
data() {
return {
domain_name: '//www.mydomain.com',
images: [
"files/image1.jpeg",
"files/image2.jpeg",
"files/image3.jpeg"
]
};
},
computed: {
image_url: function(path) {
return process.env.NODE_ENV === 'production'
? `${this.domain_name}/${path}`
: `/${path}`;
}
}
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question