Hey there fellow Developers who are working on Vuejs! I'm encountering something strange in the app I'm building. I am attempting to modify the path of image requests based on a particular result, which causes the images to change according to the modified path.
Initially, my image path was defined within a folder called assets in the app:
..assets/
dice1.png
dice2.png
dice3.png
dice4.png
dice5.png
dice6.png
Within one of my computed methods, there is a variable set with the initial part of the path string as its value,
Computed Method:
functionX(){
const assets = "../assets/dice" =====variable assigned with initial path====
var x=document.getElementById(some)
var y=1
x.style.backgroundImage="url(" + assets + y + ".png)"
}
However, when I try to use this local file path, it gives me a 404 error as if it were an external URL request. https://i.sstatic.net/dhmsX.jpg Interestingly, using an external URL for fetching images works perfectly fine. The problem arises only when trying to work with dynamically changing local files. How can I resolve this issue and make it possible to work with locally stored images?
Thanks in advance!