hilongjw / vue-lazyload

A Vue.js plugin for lazyload your Image or Component in your application.
http://hilongjw.github.io/vue-lazyload/
MIT License
7.98k stars 865 forks source link

How to use @/assets in error param? #466

Open GsHeri opened 3 years ago

GsHeri commented 3 years ago

i'm trying to display a default-user image for user avatars, if they 404.

with this code

                  <div v-lazy-container="{ selector: 'img', error: '@/assets/img/user/default-user.svg' }">
                    <img :data-src="item.user_profile_pic" class="user-img circle-avatar fiftyPx">
                  </div>

working images are displayed fine, but 404 are evaluated to localhost:8888/user/@/assets/img/user/default-user.svg how can i make the error files work and be evaluated correctly?

( this <img src="@/assets/img/user/default-user.svg"> on its own works fine, but i want it only for 404 )