流星应用程序:图像未加载 [英] meteor app: images not loading

查看:23
本文介绍了流星应用程序:图像未加载的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在用meteor 制作一个简单的聊天应用程序.我的 HTML 是:

<h1 align="center">tomomi-chat</h1><img src="original.gif"><div class="container" align="center">{{>entryfield}}

<br><div class="容器">{{>消息}}

图像不会加载到本地服务器上.由于该应用程序极其简单,因此目录中除.meteor"文件夹外没有其他文件夹..js、.css 和 .html 文件都在 app 目录中.

即使我托管图像并使用外部链接,结果也是一样.为什么流星会阻止我应用中的图像?

已部署:http://tomomi.meteor.com/

解决方案

您应该在应用程序根文件夹中创建一个名为 public 的文件夹.

来自 Meteor 文档:

<块引用>

/公开

/public 中的文件按原样提供给客户端.用这个来存储资产,例如图像.例如,如果您有一张图片在/public/background.png 中,您可以将其包含在带有背景图像的 HTML 或 CSS 中:网址(/背景.png).请注意,/public 不是图像 URL 的一部分.

I'm making a simple chat app with meteor. My HTML is:

<body>
    <h1 align="center">tomomi-chat</h1>
    <img src="original.gif">
    <div class="container" align="center">
    {{>entryfield}}
    </div>
    <br>
    <div class="container">
    {{>messages}}
    </div>  

The image won't load on the local server. As the app is extremely simplistic, there are no folders besides the '.meteor' folder in the directory. The .js, .css, and .html files are all in the app directory.

Even if I host the image and use an external link, the result in the same. Why is meteor blocking images from my app?

deployed: http://tomomi.meteor.com/

解决方案

You should create a folder named public in your application root folder.

From the Meteor documentation:

/public

Files in /public are served to the client as-is. Use this to store assets such as images. For example, if you have an image located at /public/background.png, you can include it in your HTML with or in your CSS with background-image: url(/background.png). Note that /public is not part of the image URL.

这篇关于流星应用程序:图像未加载的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
前端开发最新文章
热门教程
热门工具
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆