💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
这里是将type为text且name值为date_year时,将text文本框换成select下拉框 \admin\xxx_oo\form_builder\items\text.html ``` <div class="row dd_input_group no-gutters {$form[type].extra_class|default=''}" id="form_group_{$form[type].name}"> <label class="col-3 col-sm-2 col-md-2 col-lg-2 col-xl-1 dd_input_l col-form-label {notempty name="form[type].required"}is-required{/notempty}" for="{$form[type].name}">{$form[type].title|htmlspecialchars}</label> <div class="col-9 col-sm-9 col-md-9 col-lg-6 col-xl-4"> {notempty name="form[type].group"} <div class="input-group"> {/notempty} {notempty name="form[type].group.0"} <div class="input-group-prepend"> <span class="input-group-text">{$form[type].group.0|raw}</span> </div> {/notempty} {if condition="$form[type].name eq 'date_year'"} <select class="form-control" id="{$form[type].name}" name="{$form[type].name}" {$form[type].extra_attr|default=''}> </select> <script type="text/javascript"> window.onload=function(){ //设置年份的选择 var myDate= new Date(); var startYear=myDate.getFullYear()-50;//起始年份 var endYear=myDate.getFullYear()+50;//结束年份 var obj=document.getElementById("{$form[type].name}") for (var i=startYear;i<=endYear;i++) { obj.options.add(new Option(i,i)); } obj.options[obj.options.length-51].selected=1; $("#form_group_date_year #date_year option[value='{$form[type].value}']").attr("selected",true) } </script> {else} <input class="form-control" type="text" id="{$form[type].name}" name="{$form[type].name}" value="{$form[type].value}" placeholder="{$form[type].placeholder}" {$form[type].extra_attr|raw}> {/if} {notempty name="form[type].group.1"} <div class="input-group-append"> <span class="input-group-text">{$form[type].group.1|raw}</span> </div> {/notempty} {notempty name="form[type].group"} </div> {/notempty} </div> {notempty name="form[type].tips"} <div class="col-12 offset-sm-2 offset-md-2 offset-lg-0 offset-xl-0 col-sm-10 col-md-10 col-lg-4 col-xl-7 dd_ts"> <small class="text-muted"> <i class="fa fa-info-circle"></i> {$form[type].tips|raw} </small> </div> {/notempty} </div> ```