首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Jade条件-没有if的意外的

Jade条件-没有if的意外的
EN

Stack Overflow用户
提问于 2015-08-28 19:52:18
回答 1查看 546关注 0票数 0
代码语言:javascript
复制
block main
  h2.content-heading My profile
  .block
    .block-content.block-content-full
      a.block.block-link-hover2(href="#" data-toggle="modal" data-target="#modal-fadein" type="button")
        .block-header
            //- h3.block-title.text-center Author of the Month
        div(class="block-content block-content-full text-center bg-image" style=(account.backgroundImage))
          div
            img.img-avatar.img-avatar96.img-avatar-thumb(src=(account.avatar), alt='')
          .h5.text-white.push-15-t.push-5 #{account.displayname}
        .block-content
          .row.items-push.text-center
            .col-xs-6.col-xs-offset-3
              .push-5
            if account.premium
                i.fa.fa-bolt.fa-2x(style="color: #FF9800;")
              .h5.font-w300.text-muted Premium member
            else 
                i.fa.fa-thumbs-up.fa-2x(style="color: #3c3c3c;")
              .h5.font-w300.text-muted Free user

错误:

代码语言:javascript
复制
Unexpected else without if

我把account.premium作为假通过res.render传递。account对象下的其他所有东西都正常工作,除了这个if/else块。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-08-28 20:16:39

压痕很重要。

工作代码: if account.premium i.fa.fa-bolt.fa-2x(style="color: #FF9800;") .h5.font-w300.text-muted Premium member else i.fa.fa-thumbs-up.fa-2x(style="color: #3c3c3c;") .h5.font-w300.text-muted Free user

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32278837

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档