0

我在 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'));
});

还有其他人遇到这个吗?我能做什么?

4

1 回答 1

4

呵呵,是因为你的玉文件有错别字。

仔细检查您的img标签 - 它(如您所知)应该是src而不是scr

      .span4
        img(scr='/images/e.png', class='img') # Not working
      .span4
        img(scr='/images/f.png', class='img') # Not working
于 2013-05-13T21:51:00.687 回答