🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
## **10. form:表单** **参数** | 参数名 | 类型 | 默认值 | 说明 | | --- | --- | --- | --- | | id | int | `必填` | 表单id | **字段** | 说明| 调用代码 | | --- | --- | | 表单名称 | `{$form.table.name}` | | 表单ID | `{$form.table.id}` | | 表单字段信息,是二维数组 | `{$form.field}` | **示例** ``` {jidu:form id="8"} <form name="myform" method="post" action="submit.html" onsubmit="return CheckJob();"> <input type="hidden" name="id" value="{$form.table.id}"> {volist name="$form.field" id="vo"} <div> <label>{$vo.name}:<input type="text" name="{$vo.field}"></label> </div> {/volist} <!-- 判断验证是否开启 --> {eq name='$form.table.is_verify' value='1'} <div> <label>验证码:<input type="text" name="code"></label> <div> <img id="img" height="40" alt="验证码" src="{:captcha_src()}" title="点击刷新"> </div> </div> <script> var captcha_img = $("#img"); var verifyimg = captcha_img.attr("src"); captcha_img.on('click', function () { captcha(); }) function captcha() { if (verifyimg.indexOf('?') > 0) { captcha_img.attr("src", verifyimg + '&random=' + Math.random()); } else { captcha_img.attr("src", verifyimg.replace(/\?.*$/, '') + '?' + Math.random()); } } </script> {/eq} <div> <div> <button type="submit">提交留言</button> <button type="reset" name="reset" >重新填写</button> </div> </div> </form> {/jidu:form} ``` **说明** **form.field** 为表单字段信息