【问题标题】:can't read property "length" of undefined in jade无法读取玉中未定义的属性“长度”
【发布时间】:2017-09-15 05:20:22
【问题描述】:

table
      tbody
        tr
          th ID
          th Product Name
          th Price
          th Category
          th Action
        if data.length
         each item in data
          tr
            td #{item['_id']}
            td #{item['product_name']}
            td #{item['price']}
            td #{item['category']}
            td
               

对于此代码,我收到错误 can't read property 'length' of type undefined

【问题讨论】:

    标签: json pug


    【解决方案1】:

    只需使用 if 数据,它会执行与您现在相同的操作,测试数据是否不为空。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-11-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-10
      • 2020-09-14
      • 2018-01-11
      • 2020-12-23
      相关资源
      最近更新 更多