Posts

Showing posts with the label webpack

Vue.js Webpack: how to return an an asset path from :src binded to to a method

Vue.js Webpack: how to return an an asset path from :src binded to to a method In my component template , I have : <v-avatar :tile="tile" color="grey lighten-4" class="layout justify-start ml-0" slot="activator" size="48px"> <img class="img-circle" :src="avatarUrl" alt="avatar"> </v-avatar> the src tag is bound to the avatarUrl method methods: { avatarUrl () { if (this.user.photoUrl !== null) { return this.user.photoUrl } else { return 'https://avatars0.githubusercontent.com/u/9064066?v=4&s=46 } }, this works well... BUT if I want to use an image from the src/assets/images then the image is not used . ( no error messagecompiling or executing ) methods: { avatarUrl () { if (this.user.photoUrl !== null) { return this.user.photoUrl } else { return '../../assets/images/default-avatar.jpeg' ...