jade 笔记

按tab书写 按空格书写 缩进标示嵌套

.class.class.class#id css的写法

1
//html
<span class="abc">hi</span>
//jade
span.abc hi

incude

1
doctype html
html
	include ./header
	body
	include ./footer

extends

1
doctype html
html
	head
		block title
		title Default Title
	body
		block content

//- index.jade
extends ./layout/layout.jade

//- 进行替换
block title
	title New Title

block content
	h1 extends demo
	p content

if

if else 也要缩进换行

each in

.form-control(type="text", name="movie[flash]", value=movie.flash) [] 与 =

script(src="/js/admin.js")

input(type="radio",name="movie[category]",value=cat._id,checked=cat._id.toString()==movie.category.toString()) 比较

td: a(target="_blank", href="/movie/#{item._id}") 查看 嵌套 空格 :

可以直接写代码 要用-

1
ul.pagination
	-for(var i=0;i<totalPage;i++){
	-if(currentPage==(i+1)){
		li.active
			span #{currentPage}
		-}
	-else{
		li
			a(href='/results?p=#{i}&#{query}') #{i+1}
		-}
	-}

注释 //-script(src="/js/main.js")