I'm working on a project and trying to make a modal with an image within, but the image never appears. I have tryed every posible path and some functions like fs but nothing. The structure of my proyect is this:
-main
|-dist
|-node_modules(sweetalert2 ubication)
|-public
|-src
|-App.vue
|-main.js
|-assets -(where is the image "img.jpg")
|- ...
|- ...
|-views
|-...(some views.vue)
|-myView.vue
At myView.vue I use $swal.fire and try to insert an image using imageUrl but only gets the alt for the image. How could I add this image to the sweetalert2 modal, or at least how could I know what is the path from where sweetalert2 modal is loading. This is my options for the sweetalert2 modal with the last path I tried:
var options = {
title: "¿Seguro que quiere eliminar el activo?",
imageUrl: "../assets/papelera.jpg",
imageHeight: "100px",
imageAlt: "papelera",
text: "Una vez eliminado desaparecerá el presupuesto que haya realizado sobre ese activo.",
showConfirmButton: true,
showCancelButton: true,
cancelButtonText: "Cancelar",
confirmButtonText: "Borrar"
};
A second after I ask the question I have found the answe, Using require(../assets/img.jpg)
it works fine.