[Jade] Use Mixins in Pug
in use Jade mixins
2023-09-14 08:59:18 时间
Mixin works as a function.
extends layout include mixins/storeForm block content .inner h2 #{title} +storeForm({name: 'NODE'})
Here, we use include keyword to inlcude a mixin file.
include mixins/storeForm
Exec a mixin function we can use '+':
+storeForm({name: 'NODE'})
Define a mixin:
mixin storeForm(store = {}) form(action="/add" method="POST" class="card") label(for="name") Name input(type="text" name="name") label(for="description") Description textarea(name="description") - const choices = ['Wifi', 'Open Late', 'Fmaily Friendly', 'Vegatarian', 'Licensed']; ul.tags each choice in choices .tag.tag__choice input(type="checkbox" id=choice value=choice name="tags") label(for=choice) #{choice} input(type="submit" value="Save" class="button")
Here we use some js code:
- const choices = ['Wifi', 'Open Late', 'Fmaily Friendly', 'Vegatarian', 'Licensed'];
to hard code some categories.
相关文章
- forEach、for in 、 for of三者的区别
- use SceneKit to display 3d objects in an iOS project
- ORA-27086: unable to lock file – already in use ORACLE 报错 故障修复 远程处理
- ORA-27209: syntax error in device PARMS – unknown keyword or missing = ORACLE 报错 故障修复 远程处理
- ORA-29660: Unable to find the class defined in the EXTERNAL NAME clause ORACLE 报错 故障修复 远程处理
- ORA-30094: failed to find the time zone data file for version string in $ORACLE_HOME/oracore/zoneinfo ORACLE 报错 故障修复 远程处理
- ORA-31605: the following was returned from string in routine string: LPX-number: string ORACLE 报错 故障修复 远程处理
- ORA-41646: missing “string” attribute for “string” element in the rule condition ORACLE 报错 故障修复 远程处理
- ORA-46073: Cookie already in use by another session ORACLE 报错 故障修复 远程处理
- ORA-48262: Sequence references not allowed in predicates ORACLE 报错 故障修复 远程处理
- ORA-01654: unable to extend index string.string by string in tablespace string ORACLE 报错 故障修复 远程处理
- ORA-13547: Unable to drop baseline since it is in use by string ORACLE 报错 故障修复 远程处理
- ORA-15236: diskgroup string mounted in restricted mode ORACLE 报错 故障修复 远程处理
- ORA-16577: corruption detected in Data Guard configuration file ORACLE 报错 故障修复 远程处理
- MySQL删除IN操作: 简易指南(mysql删除in)
- 进行字符串比较使用Oracle IN运算符比较字符串(oracle使用in)
- 限制Oracle IN语句元素数量限制(oracle的in个数)
- 研究Oracle中in的用法(oraclein的用法)
- 子查询MySQL联表IN子查询:实现跨表快速查询(mysql联表in)
- Understanding the Use of FloatingPoint Data Type in MySQL(mysql浮点型)
- 使用MySQL中的USE命令进入指定库(mysql中use某个库)
- MySQL中的Out和In操作一个简单的指南(mysql中out in)
- MySQL的IN操作符对于查询中给定的值列表长度是有限制的(mysql中in长度限制)
- MySQL中IN操作最大长度详解(mysql中in最大长度)
- MySQL中的IN查询的性能优化(mysql中in性能)
- MySQL中的IN子句如何利用索引实现高效查询(mysql中in使用索引)
- 排除 MySQL 中的字段使用NOT IN操作符(mysql 不包含的字段)
- 无需使用USE命令,轻松管理MySQL数据库(mysql不用use)
- 探索Oracle中IN查询的精彩之处(oracle中的in查询)
- 条件在Oracle中使用IN和OR查询条件的巧妙之处(oracle中in跟or)