Hola, encontré este control deslizante de imágenes para Vue.js en "digitalocean.com", pero solo funciona con imágenes cargadas en (imgbb, pixabay, etc.). Intento configurar con una imagen local (en activos) pero no funciona, ¿alguien puede ayudarme? Ya probé con ../assets/castelgandolfo.jpg o ./assets/castelgandolfo.jpg ¡perdón por mi inglés!
Este es el código:
export default { name: "Slider", data() { return { images: [ "https://i.ibb.co/6NJ7p6w/Castelgandolfo.jpg", "https://i.ibb.co/QJN06cG/Grottaferrata.jpg", "https://i.ibb.co/R3pHtGx/Ariccia.jpg", ], timer: null, currentIndex: 0 }; }, mounted: function() { this.startSlide(); }, methods: { startSlide: function() { this.timer = setInterval(this.next, 10000); }, next: function() { this.currentIndex += 1; }, prev: function() { this.currentIndex -= 1; } }, computed: { currentImg: function() { return this.images[Math.abs(this.currentIndex) % this.images.length]; } } };Puede referir imágenes directamente usando '@'
Ejemplo:
<img src="@/assets/images/home.png"/>