0

My problem is I saved an image to the local storage but when I retrieve it from vuex and paste it into the code the image does not appear.

The object I get from vuex:

place: {
    ....
    imgPath: C:\Users\...\Pictures\abc\b\first.jpg
    ....
}

and vuetify code:

<v-img v-bind:src="place.imgPath"></v-img>
javorkabotond
  • 39
  • 1
  • 6

2 Answers2

2

Vue is intended to be run on a webserver. Including files directly from your local hard drive is a security problem and thus not allowed. Either include the image in your assets so Vue can include it that way, or host the image on a domain somewhere, so you can hot link it from there. Again, paths starting with a drive letter will not (and should not) work.

Sumurai8
  • 20,333
  • 11
  • 66
  • 100
0

here you have a stack question on image in localstorage and accessing it: How to save an image to localStorage and display it on the next page?

and here the vue official doc for client side storage: https://v2.vuejs.org/v2/cookbook/client-side-storage.html

should be enough to answer your issue :)

tony19
  • 125,647
  • 18
  • 229
  • 307
Dylan Tuna
  • 85
  • 2
  • 6