[英]Aframe not loading image from local path in angular and arjs
我正在尝试从本地路径加载图像。 代码在 angular 中的 app.component.html 中。 这是我的代码:
<a-scene embedded arjs>
<a-assets>
<img id="test_img" src="/mnt/r/flipkart/proj/src/app/abcd.jpg">
</a-assets>
<a-marker preset="hiro" url="hiro.patt">
<a-image
rotation="90 0 0"
src="#test_img"></a-image>
<!-- <a-image
rotation="90 0 0"
src="#imge" id="baba"></a-image> -->
</a-marker>
<a-entity camera></a-entity>
<div style='position: fixed; top: 10px; width:100%; text-align: center; z-index: 1;'>
<button (click)="hideme()">
HIDE OBJECTS
</button>
</div>
</a-scene>
在控制台上,我收到此消息:
GET http://localhost:4200/mnt/r/flipkart/proj/src/app/abcd.jpg 404 (Not Found)
我怎样才能得到它以避免发出获取请求而只使用本地文件夹中的图像。
我怎样才能得到它以避免发出获取请求
您可以指定要使用file://
协议,即: file:///mnt/r/flipkart/proj/src/app/abcd.jpg
由于跨域策略,尽管通过文件协议加载的图像、视频或音频都无法与a-frame
一起使用file
如果你在本地开发,你仍然需要一个服务器来托管资产。
文档建议:
SimpleHTTPServer
模块
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.