[Vuejs]-Display image from laravel in vuejs

0👍

you can create a javascript asset() helper function

in you main main.blade.php file which includes in all of your file

add this script

<script>
      window.asset = function(url){
          return "{{ asset('/') }}" + url;
      }
</script>

or you can assign to vue instance like this

<script>
    window.Vue.prototype.asset = function(url){
        return "{{ asset('/') }}" + url;
    }
</script>

then inside javascript you can do like asset('image.png')

Leave a comment