Vuejs image src dynamic load doesn't work

后端 未结 1 761
不知归路
不知归路 2021-01-06 13:05

I just started using Vue.js and Vue CLI and i\'m facing an issue, i don\'t understand why i can\'t set the image dynamically from the scope but i can do it writing it direct

1条回答
  •  离开以前
    2021-01-06 13:45

    So the real fix would be this:

    :src="getImage(obj.img)"
    
    getImage(path) {
      return require(path)
    }
    

    You can read more about it in this response from Evan, the creator of Vue

    0 讨论(0)
提交回复
热议问题