Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
346 views
in Technique[技术] by (71.8m points)

javascript - 我的Jade for循环代码有什么问题?(What is wrong with my Jade for loop code?)

These are my entire loop code of Jade(这些是我的整个Jade循环代码)

block content div(class='row') div(class='col-lg-12') h1(class='subject') ???? div(class='row') div(class='col-lg-8') - for (var i=0; i<3; i++) div(class='row') - for (var j=0; j<12; j++) p 1 div(class='col-lg-4') div(class='row') h5(style='text-align:center') ?????? div(class='row') ul(id="message" class='list-group') div(class='row') form(action="", class='form-inline') div(class='form-group') input(id="m", class='form-control', autocomplete="off") button(class="btn btn-default") Send script(src="/socket.io/socket.io.js") script(src="https://code.jquery.com/jquery-1.11.1.js") script(src="/javascripts/makeSocketVariable.js") And these are the section has the result don't expect.(这些是本节所预期的结果。) div(class='row') div(class='col-lg-8') - for (var i=0; i<3; i++) div(class='row') - for (var j=0; j<12; j++) p 1 It just get result two div and a p tag.(它只是得到结果两个div和一个p标签。) I expect 3 div and each 12- p tag inside that.(我希望3 div和其中的每个12-p标签。) What is wrong with my Jade loop code ?(我的Jade循环代码有什么问题?)   ask by Anton ??? translate from so

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The problem is with your indentation.(问题出在您的缩进。)

This is fixed form(这是固定形式) div(class='row') div(class='col-lg-8') - for (var i = 0; i < 3; i++) div(class='row') - for (var j = 0; j < 12; j++) p #{j} As you can see, you aren't nesting p inside for loop.(如您所见,您没有将p嵌套在for循环中。)

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...