index页面的遍历报错
extends ../layout block content .container .row each item in movies .col-md-2 .thumbnail a(href="/movie/#{item._id}") img(src="#{item.poster}", alt="#{item.title}") .caption h3 #{item.title} p: a.btn.btn-primary(href = "/movie/#{item._id}", role ="button") 观看预告片
第六行报错:
TypeError: E:\NodeMovie\imooc\views\pages\index.jade:6
4| .container
5| .row
> 6| each item in movies
7| .col-md-2
8| .thumbnail
9| a(href="/movie/#{item._id}")
Cannot read property 'length' of undefined
at eval (eval at <anonymous> (E:\NodeMovie\imooc\node_modules\jade\lib\index.js:218:8), <anonymous>:103:31)
at eval (eval at <anonymous> (E:\NodeMovie\imooc\node_modules\jade\lib\index.js:218:8), <anonymous>:224:4)
at eval (eval at <anonymous> (E:\NodeMovie\imooc\node_modules\jade\lib\index.js:218:8), <anonymous>:240:22)
at res (E:\NodeMovie\imooc\node_modules\jade\lib\index.js:219:38)
at Object.exports.renderFile (E:\NodeMovie\imooc\node_modules\jade\lib\index.js:380:38)
at Object.exports.renderFile (E:\NodeMovie\imooc\node_modules\jade\lib\index.js:370:21)
at View.exports.__express [as engine] (E:\NodeMovie\imooc\node_modules\jade\lib\index.js:417:11)
at View.render (E:\NodeMovie\imooc\node_modules\express\lib\view.js:128:8)
at tryRender (E:\NodeMovie\imooc\node_modules\express\lib\application.js:640:10)
at EventEmitter.render (E:\NodeMovie\imooc\node_modules\express\lib\application.js:592:3)
这段明明跟老师的代码是一样的啊,前面数组长度我也打印出来了没有问题呀