直接上代码,我也不知道这个玩法对不对,反正这样玩不用再去查数据字典了,封装的layui的
#--下拉选--# #define select(name,title,table,code,text,extend,verify,value) <select name="#(name)" lay-verify="#(verify)" lay-search> <option value="">选择#(title)可搜索</option> #for(x:xKit.getD(table,code,text,extend)) <option value="#(xKit.getFirst(x)??)" #if(value==xKit.getFirst(x)) selected #end>#(xKit.getLast(x)??)</option> #end </select> 下面是工具类xkit //查询数据字典 public static List<String> getD(String table,String code,String text,String extend){ List<String> l = new ArrayList<String>(); List<Record> ls = Db.find(Db.getSqlPara("fD", Kv.by("table", table) .set("text",text) .set("code",code) .set("extend",extend))); for (Record record : ls) { l.add(record.getStr(code)+","+record.getStr(text)); } return l; } public static String getFirst(String s){ return s.split(",")[0]; } public static String getLast(String s){//emptyToNull(String str) return s.split(",")[1]; } //下面是用法 <div class="layui-form-item" pane> <label class="layui-form-label">标题</label> <div class="layui-input-block"> #@radio("title","标题","blog","id","title","","required","308892119093739520") #@layuploads("title","标题","required","") </div> </div>