Html 如何在Pug中使用条件语句
我有下面的PUG代码,我想使用if语句,以便使用for循环打印提交按钮Html 如何在Pug中使用条件语句,html,pug,web-frontend,Html,Pug,Web Frontend,我有下面的PUG代码,我想使用if语句,以便使用for循环打印提交按钮 html head title test link(type="text/css" rel="stylesheet" href="css/styles.css") meta(name="viewport" content="width=device-width, initial-scale=1") body -inputTypes = ['tex
html
head
title test
link(type="text/css" rel="stylesheet" href="css/styles.css")
meta(name="viewport" content="width=device-width, initial-scale=1")
body
-inputTypes = ['text','email','password','password']
-placeholders = ['username','email','password','confirm password']
-values = ['submit']
div.cont_login
center
img(src="images/user.png")
form(method="post" action="index.html")
for i in [0,1,2,3]
input(type=inputTypes[i] placeholder=placeholders[i])
input(type="submit" value="submit")
这是PUG中if语句的语法:
if condition
code
else if condition2
code2
else
code3
在您的情况下,您需要检查i是否是最后一次迭代(3),然后打印提交输入(如果是)。谢谢,这很有用