search

Home  >  Q&A  >  body text

javascript - How does this jade code look like when written as html?

block content
  h1= title
  p Welcome to Todo
  a(href='/tasks/new') 新增
  - if(docs.length)
    table
      tr
        th Task
          each task in docs
            tr
              td 
                a(href='/tasks/edit/#{task.id}') #{task.task} 
                a(href='/tasks/delete/#{task.id}') 删除
  - else 
    p You don't have any tasks!
習慣沉默習慣沉默2862 days ago493

reply all(2)I'll reply

  • 我想大声告诉你

    我想大声告诉你2017-05-19 10:49:26

    jade 模版也得在第一次生成的时候拿到 docs 这个变量的内容才能生成 html .

    This code unless docs 是静态的,否则怎么也写不成万能的 html,只能根据特定的 docs 写特定的 html

    reply
    0
  • 某草草

    某草草2017-05-19 10:49:26

    You can put some static data on it first and then use the jade_to_html URL to jade 转换成 html.

    reply
    0
  • Cancelreply