h2 mixin mixin lesson p jade study +lesson mixin study(name,courses) p #{name} ul.courses each course in courses li= course +study("wangjie",["jade", "node"]) mixin testEmbedded(stu) p #{stu.name} +study(stu.name,stu.courses) +testEmbedded({name:"wangjie",courses:["jade", "node"]}) //block mixin team(value01) p #{value01} if block block else p has no block +team("wangj") h2 test block //attr mixin attr(name) h2(class!=attributes.class) #{name} +attr(‘attr‘)(class=‘testAttr‘) //多个属性嵌入 mixin attrs(name) p&attributes(attributes) #{name} +attrs("attrs")(class=‘pclass‘,id=‘pid‘) mixin magic(name ,items) ul(class=‘#{name}‘) each item in items li= item +magic(‘magic‘,[‘node‘,‘jade‘,‘...‘])
时间: 2024-10-12 20:34:50