element.html 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  1. <title>表单元素</title>
  2. <div class="layui-card layadmin-header">
  3. <div class="layui-breadcrumb" lay-filter="breadcrumb">
  4. <a lay-href="">主页</a>
  5. <a><cite>组件</cite></a>
  6. <a><cite>表单</cite></a>
  7. <a><cite>表单元素</cite></a>
  8. </div>
  9. </div>
  10. <style>
  11. /* 这段样式只是用于演示 */
  12. </style>
  13. <div class="layui-fluid">
  14. <div class="layui-row layui-col-space15">
  15. <div class="layui-col-md6">
  16. <div class="layui-card">
  17. <div class="layui-card-header">输入框</div>
  18. <div class="layui-card-body layui-row layui-col-space10">
  19. <div class="layui-col-md12">
  20. <input type="text" name="title" placeholder="请输入标题" autocomplete="off" class="layui-input">
  21. </div>
  22. <div class="layui-col-md6">
  23. <input type="text" name="title" placeholder="用户名" autocomplete="off" class="layui-input">
  24. </div>
  25. <div class="layui-col-md6">
  26. <input type="password" name="title" placeholder="密码" autocomplete="off" class="layui-input">
  27. </div>
  28. </div>
  29. </div>
  30. <div class="layui-card layui-form" lay-filter="component-form-element">
  31. <div class="layui-card-header">下拉选择框</div>
  32. <div class="layui-card-body layui-row layui-col-space10">
  33. <div class="layui-col-md6">
  34. <select name="city" lay-verify="">
  35. <option value="">请选择一个城市</option>
  36. <option value="010">北京</option>
  37. <option value="021">上海</option>
  38. <option value="0571">杭州</option>
  39. </select>
  40. </div>
  41. <div class="layui-col-md6">
  42. <select name="city" lay-verify="">
  43. <option value="010">北京</option>
  44. <option value="021" disabled>上海(禁用效果)</option>
  45. <option value="0571" selected>杭州</option>
  46. </select>
  47. </div>
  48. <div class="layui-col-md6">
  49. <select name="quiz">
  50. <option value="">请选择</option>
  51. <optgroup label="城市记忆">
  52. <option value="你工作的第一个城市">你工作的第一个城市?</option>
  53. </optgroup>
  54. <optgroup label="学生时代">
  55. <option value="你的工号">你的工号?</option>
  56. <option value="你最喜欢的老师">你最喜欢的老师?</option>
  57. </optgroup>
  58. </select>
  59. </div>
  60. <div class="layui-col-md6">
  61. <select name="city" lay-verify="required" lay-search>
  62. <option value="">带搜索的选择框</option>
  63. <option value="1">layer</option>
  64. <option value="2">form</option>
  65. <option value="3">layim</option>
  66. <option value="4">element</option>
  67. <option value="5">laytpl</option>
  68. <option value="6">upload</option>
  69. <option value="7">laydate</option>
  70. <option value="8">laypage</option>
  71. <option value="9">flow</option>
  72. <option value="10">util</option>
  73. <option value="11">code</option>
  74. <option value="12">tree</option>
  75. <option value="13">layedit</option>
  76. <option value="14">nav</option>
  77. <option value="15">tab</option>
  78. <option value="16">table</option>
  79. <option value="17">select</option>
  80. <option value="18">checkbox</option>
  81. <option value="19">switch</option>
  82. <option value="20">radio</option>
  83. </select>
  84. </div>
  85. <div class="layui-col-md12">
  86. <select name="city" lay-verify="">
  87. <option value="">请选择一个城市</option>
  88. <option value="010">北京</option>
  89. <option value="021">上海</option>
  90. <option value="0571">杭州</option>
  91. </select>
  92. </div>
  93. </div>
  94. </div>
  95. <div class="layui-card layui-form" lay-filter="component-form-element">
  96. <div class="layui-card-header">复选框</div>
  97. <div class="layui-card-body layui-row layui-col-space10">
  98. <div class="layui-col-md12">
  99. <input type="checkbox" name="" title="写作" checked>
  100. <input type="checkbox" name="" title="发呆">
  101. <input type="checkbox" name="" title="禁用" disabled>
  102. </div>
  103. <div class="layui-col-md12">
  104. <input type="checkbox" name="" title="写作" lay-skin="primary" checked>
  105. <input type="checkbox" name="" title="发呆" lay-skin="primary">
  106. <input type="checkbox" name="" title="禁用" lay-skin="primary" disabled>
  107. <input type="checkbox" name="" lay-skin="primary">
  108. </div>
  109. </div>
  110. </div>
  111. <div class="layui-card layui-form" lay-filter="component-form-element">
  112. <div class="layui-card-header">开关</div>
  113. <div class="layui-card-body layui-row layui-col-space10">
  114. <div class="layui-col-md12">
  115. <input type="checkbox" name="xxx" lay-skin="switch">
  116. <input type="checkbox" name="yyy" lay-skin="switch" lay-text="ON|OFF" checked>
  117. <input type="checkbox" name="zzz" lay-skin="switch" lay-text="开启|关闭">
  118. <input type="checkbox" name="aaa" lay-skin="switch" disabled>
  119. </div>
  120. </div>
  121. </div>
  122. <div class="layui-card layui-form" lay-filter="component-form-element">
  123. <div class="layui-card-header">单选框</div>
  124. <div class="layui-card-body layui-row layui-col-space10">
  125. <div class="layui-col-md12">
  126. <input type="radio" name="sex" value="nan" title="男">
  127. <input type="radio" name="sex" value="nv" title="女" checked>
  128. <input type="radio" name="sex" value="" title="中性" disabled>
  129. </div>
  130. </div>
  131. </div>
  132. </div>
  133. <div class="layui-col-md6">
  134. <div class="layui-card">
  135. <div class="layui-card-header">文本域</div>
  136. <div class="layui-card-body layui-row layui-col-space10">
  137. <div class="layui-col-md12">
  138. <textarea name="" placeholder="请输入" class="layui-textarea"></textarea>
  139. </div>
  140. </div>
  141. </div>
  142. <div class="layui-card">
  143. <div class="layui-card-header">响应式组合</div>
  144. <div class="layui-card-body">
  145. <form class="layui-form" action="" lay-filter="component-form-element">
  146. <div class="layui-row layui-col-space10 layui-form-item">
  147. <div class="layui-col-lg6">
  148. <label class="layui-form-label">员工姓名:</label>
  149. <div class="layui-input-block">
  150. <input type="text" name="fullname" lay-verify="required" placeholder="" autocomplete="off" class="layui-input">
  151. </div>
  152. </div>
  153. <div class="layui-col-lg6">
  154. <label class="layui-form-label">技术工种:</label>
  155. <div class="layui-input-block">
  156. <select name="type" lay-verify="required" lay-filter="aihao">
  157. <option value=""></option>
  158. <option value="0">前端工程师</option>
  159. <option value="1">Node.js工程师</option>
  160. <option value="2">PHP工程师</option>
  161. <option value="3">Java工程师</option>
  162. <option value="4">运维</option>
  163. <option value="4">视觉设计师</option>
  164. </select>
  165. </div>
  166. </div>
  167. </div>
  168. <div class="layui-form-item">
  169. <label class="layui-form-label">兴趣爱好:</label>
  170. <div class="layui-input-block">
  171. <input type="checkbox" name="interest[write]" title="写作">
  172. <input type="checkbox" name="interest[read]" title="阅读">
  173. <input type="checkbox" name="interest[code]" title="代码" checked>
  174. <input type="checkbox" name="interest[dreaming]" title="做梦">
  175. </div>
  176. </div>
  177. <div class="layui-form-item">
  178. <label class="layui-form-label">是否婚姻:</label>
  179. <div class="layui-input-block">
  180. <input type="checkbox" name="marriage" lay-skin="switch" lay-text="是|否">
  181. </div>
  182. </div>
  183. <div class="layui-form-item">
  184. <label class="layui-form-label">所属职称:</label>
  185. <div class="layui-input-block">
  186. <input type="radio" name="role" value="" title="经理">
  187. <input type="radio" name="role" value="" title="主管">
  188. <input type="radio" name="role" value="" title="码农" checked>
  189. <input type="radio" name="role" value="" title="端水">
  190. </div>
  191. </div>
  192. <div class="layui-form-item">
  193. <label class="layui-form-label">其它信息:</label>
  194. <div class="layui-input-block">
  195. <textarea name="other" placeholder="" class="layui-textarea"></textarea>
  196. </div>
  197. </div>
  198. <div class="layui-form-item">
  199. <label class="layui-form-label"> </label>
  200. <div class="layui-input-block">
  201. <input type="checkbox" name="" title="同意" lay-skin="primary" checked>
  202. </div>
  203. </div>
  204. <div class="layui-form-item">
  205. <div class="layui-input-block">
  206. <button class="layui-btn" lay-submit lay-filter="component-form-element">立即提交</button>
  207. <button type="reset" class="layui-btn layui-btn-primary">重置</button>
  208. </div>
  209. </div>
  210. </form>
  211. </div>
  212. </div>
  213. </div>
  214. </div>
  215. </div>
  216. <script>
  217. layui.use(['admin', 'form'], function(){
  218. var $ = layui.$
  219. ,admin = layui.admin
  220. ,element = layui.element
  221. ,form = layui.form;
  222. form.render(null, 'component-form-element');
  223. element.render('breadcrumb', 'breadcrumb');
  224. form.on('submit(component-form-element)', function(data){
  225. layer.msg(JSON.stringify(data.field));
  226. return false;
  227. });
  228. });
  229. </script>