Vue.js
- 1 ответ
- 0 вопросов
1
Вклад в тег
<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>