0

Hello i am planning to bind my img src to a dynamic one so it will be editable as it will be coming from the AEM. Currently i am testing it on my local using image assets Line 1 is the static data and it is working but when it is coming from props or init data it is not working my init data is an object Line 2 it is not working i have found some on the internet but idk how to edit this because on the AEM the path will be different and not assets. I would to ask an assistance on how should the method be edited so it can work on local assets and aem

Init Data Below

  "serviceRequestReconnectComponent": {
          "reconnectActiveLogo": "../../../assets/images/Reconnect_linewhite2x.png",
          "reconnectInactiveLogo": "../../../assets/images/Reconnect_line2x.png",
          "reconnectImageText": "Reconnect Mobile Line",
    }

Line 1 <img v-else src="../../../assets/images/Reconnect_linewhite2x.png" />

Line 2 (using props)

<img v-else :src="serviceRequestReconnectComponent.reconnectInactiveLogo" />

Vue.js dynamic images not working

` methods: {
    resolve_img_url: function (path) {
      let images = require.context('../assets/', false, /\.png$|\.jpg$/)
      return images("./"+path)
    }
  }`
pine ching
  • 15
  • 6

0 Answers0