我在 Jade 中使用 Express.js 并遇到了问题。我有 6 张图片,但其中 2 张不会显示在页面上。我可以去local:3000/images/a.png
查看它们,但在我的页面上看不到它们?这是我的一些 Jade HTML:
.span4
img(src='/images/a.png', class='img')
.span4
img(src='/images/b.png', class='img')
.span4
img(src='/images/c.png', class='img')
.row-fluid
.span4
img(src='/images/d.png', class='img')
.span4
img(scr='/images/e.png', class='img') # Not working
.span4
img(scr='/images/f.png', class='img') # Not working
app.js
如果它有帮助,这是我的:
var express = require('express')
, routes = require('./routes')
, user = require('./routes/user')
, http = require('http')
, path = require('path');
var app = express();
// all environments
app.set('port', process.env.PORT || 3000);
app.set('views', __dirname + '/views');
app.set('view engine', 'jade');
app.use(express.favicon(__dirname + '/public/images/icon.ico'));
app.use(express.logger('dev'));
app.use(express.bodyParser());
app.use(express.methodOverride());
app.use(app.router);
app.use(express.static(path.join(__dirname, 'public')));
// development only
if ('development' == app.get('env')) {
app.use(express.errorHandler());
}
app.get('/', routes.index);
app.get('/users', user.list);
http.createServer(app).listen(app.get('port'), function(){
console.log('Express server listening on port ' + app.get('port'));
});
还有其他人遇到这个吗?我能做什么?