如何使用vuejs从SPA的/storage -laravel-访问映像 [英] How to access image from /storage -laravel- from SPA with vuejs

查看:57
本文介绍了如何使用vuejs从SPA的/storage -laravel-访问映像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我将图片放在"storage/app/public/img/logo.png"中并执行:

if i put an image in "storage/app/public/img/logo.png" and execute: 

$ php artisan storage:link

我如何在Vue组件中获取logo.png?

How i get that logo.png in vue component?

<img src="storage/app/public/img/logo.png">

请求没问题(200),但该图像无法渲染,因为它是SPA.

The requested it's ok (200) but that image not render, because is an SPA.

谢谢

推荐答案

那么,做完之后:

$ php artisan storage:link

在我的组件中,我使用了:

In my component i used:

<img :src="'../storage/img/logo.png'">

谢谢

这篇关于如何使用vuejs从SPA的/storage -laravel-访问映像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆