0👍
Yes, you can save it to a separate js file and import from there.
//../assets/gallery.js or where ever you want to save the file
export const gallery = [
{
backgroundColor: "#480572",
src: "./assets/img/someimage1.png",
alt: "Alt text for image 1",
title: "title text for image 1",
dataSrc: "./assets/link-additional-image1.png",
dataColor: "#ebebf7"
},
{
backgroundColor: "#2A3132",
src: "./assets/img/someimage2.png",
alt: "Alt text for image 2",
title: "title text for image 1",
dataSrc: "./assets/link-additional-image2.png",
dataColor: "#FFFFFF"
},
....
// A large number of these items
]
In gallery component
<script>
import GalleryItem from './component/galleryItem.vue'
import { gallery } from '../assets/gallery.js'
export default {
name: 'Gallery',
data() {
return {
gallery
}
},
components: {
GalleryItem
}
}
</script>
- [Vuejs]-Emit click in other class in Vue js
- [Vuejs]-Return Vue Variable or Vue Component to Laravel Blade
Source:stackexchange.com