简体   繁体   English

如何在Meteor的移动版本中包含本地资源?

[英]How to include local resources in mobile build of Meteor?

relatively newbie question about meteor mobile (Android). 关于流星移动(Android)的相对较新的问题。 I'm a bit lost regarding the inclusion of images and other assets into the Cordova build of my Meteor app (just so the Android app doesn't have to download the images off the server, and just include it in the build.) 对于将图像和其他资产包含到我的Meteor应用程序的Cordova构建中,我有些失落(只是Android应用程序不必从服务器上下载图像,而只需将其包含在构建中即可。)

I've tried pasting the same images I added in the public folder inside Cordova build folder (inside the project) but I don't think that's how it works. 我试过粘贴在Cordova build文件夹(项目内部)的公用文件夹中添加的相同图像,但我认为这不是这样。 And another is how to use those images as a source for the img items. 另一个是如何使用这些图像作为img项目的源。

The end goal is to be able to direct the img src to a local file included in the build so that it doesn't have to download it from the server. 最终目标是能够将img src定向到构建中包含的本地文件,从而不必从服务器下载它。

I hope to hear some advice soon! 我希望很快能听到一些建议! Thank you! 谢谢!

As per our discussion here: https://forums.meteor.com/t/how-to-use-webapplocalserver-localfilesystemurl-documentation-or-example/29881/2 根据我们在这里的讨论: https : //forums.meteor.com/t/how-to-use-webapplocalserver-localfilesystemurl-documentation-or-example/29881/2

The solution is to use a relative URL /myImage.jpg . 解决方案是使用相对URL /myImage.jpg When served via cordova this will point to the applications local storage of static resources. 通过cordova提供服务时,这将指向应用程序本地静态资源存储。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM