Currently making the transition to vite with vuejs and facing a particular issue:
While debugging, I have a component that needs to display images from a folder:
imageArray: [
require ("../ assets / dummies / Mission -1.jpg"),
require ("../ assets / dummies / Mission -2.jpg"),
require ("../ assets / dummies / Mission -3.jpg"),
require ("../ assets / dummies / Mission -4.jpg")
]
Within the component resides the following div:
<div: class = "bgClass" v-if = "isDebug () == true"> </div>
Following this is a dynamic class using computed property which allows for scrolling through the images.
computed: {
bgClass: function () {
return {
backgroundImage: 'url (' + this.imageArray [this.imagePos] + ')',
...
}
}
}
The 'require' feature is not supported in Vite, and I would prefer not to convert the old vue2 components to the new vue3 composition API.
Is there an easy way to load images into an array and navigate through them in the component?