【问题标题】:express, coffeescript, Title not workingexpress,coffeescript,标题不起作用
【发布时间】:2013-06-19 13:51:49
【问题描述】:

我有咖啡文件,我正在关注 peepcode 截屏视频 069。

 routes = (app) ->
 app.get '/login', (req, res) ->
 res.render "#{__dirname}/views/login",
   title: 'Login'
   stylesheet: 'Login'

 module.exports = routes

这是我的 layout.jade 文件

  doctype 5
  html
   head
      title= title
      link(rel='stylesheet', href='/stylesheets/style.css')
    body
       block content

没有,当我在本地服务器上点击网页时,它确实显示,但标题未显示为登录。我错过了什么?

【问题讨论】:

  • 你的视图是什么样的?

标签: express coffeescript


【解决方案1】:

不确定你提到的一半,但看看 CS:你的函数没有正确缩进。不应该是这样的吗:

routes = (app) ->
  app.get '/login', (req, res) ->
    res.render "#{__dirname}/views/login",
      title: 'Login'
      stylesheet: 'Login'

module.exports = routes

【讨论】:

    猜你喜欢
    • 2012-09-22
    • 1970-01-01
    • 1970-01-01
    • 2013-11-23
    • 2015-10-16
    • 2014-01-14
    • 1970-01-01
    • 1970-01-01
    • 2017-04-30
    相关资源
    最近更新 更多