停止帕格的每个循环

时间:2017-01-31 02:40:36

标签: node.js pug

这是我的mixin:

mixin treeview(...routes)
  each route in routes
    //- path is a variable which I passed from express
    if (path === route)
      li.treeview.active
        if block
          block
        //- stop right here

在Javascript中似乎是break

1 个答案:

答案 0 :(得分:1)

您可以使用 - 中断

mixin treeview(...routes)
  each route in routes
    //- path is a variable which I passed from express
    if (path === route)
      li.treeview.active
        if block
          block
          - break
          //- stop right here

一个简单的demo