[Vuejs]-How can I convert a relative image url to absolute image url in Vue js?

3👍

Your syntax is wrong, should be:

<img :src="`https://my_domain.com${item.settings.image.path}`">

Example:

new Vue({
  el: "#app",
  data: {
    link: '/vi/MPV2METPeJU/maxresdefault.jpg',
  }
})
<script src="https://cdnjs.cloudflare.com/ajax/libs/vue/2.5.17/vue.js"></script>

<div id="app">
  <img :src="`https://i.ytimg.com${link}`">
</div>
👤Vucko

Leave a comment