laytpl模版引擎不能写select标签....

已采纳
6 430
空闲广告位,联系:xianxin@layui.com
  • 第一把菜刀 第一把菜刀
    2017-01-06 15:10:40
    是这样的吧:laytpl渲染之后才出现的html,有html之后你再去渲染select就出来了
    0 回复
  • 1253398319 1253398319
    2017-01-06 14:28:42
    页面效果没有下拉列表...
    0 回复
  • vip_admin vip_admin
    2017-01-06 14:34:00
    好像是要在form表单内,js要使用form模块才行
    0 回复
  • 1253398319 1253398319
    2017-01-06 14:44:54
    如果去掉模版,则select可以出来.
    0 回复
  • 1253398319 1253398319
    2017-01-06 15:06:03
    <%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
    <%
    String path = request.getContextPath();
    String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    %>
    <!DOCTYPE html>
    <html lang="en">
    <head>
    <base href="<%=basePath%>">
    <meta charset="UTF-8">
    <title>个人信息</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="format-detection" content="telephone=no">
    <link rel="stylesheet" type="text/css" href="jsp/common/layui/css/layui.css" media="all">
    <link rel="stylesheet" type="text/css" href="jsp/common/bootstrap/css/bootstrap.css" media="all">
    <link rel="stylesheet" type="text/css" href="jsp/common/global.css" media="all">
    <link rel="stylesheet" type="text/css" href="jsp/userMg/css/personal.css" media="all">
    </head>
    <body>
    <section class="layui-larry-box">
    <div class="larry-personal">
    <header class="larry-personal-tit">
    <span>个人信息</span>
    </header><!-- /header -->
    <div class="larry-personal-body clearfix">
    <form id="view" class="layui-form col-lg-5" lay-filter="aa" action="" method="post">
    <div class="layui-form-item">
    <label class="layui-form-label">开户银行</label>
    <div class="layui-input-block">
    <select name="l_bank">
    <option value="0">中国银行</option>
    <option value="1">中国建设银行</option>
    <option value="2">中国农业银行</option>
    <option value="3">中国工商银行</option>
    </select>
    </div>
    </div>

    <script id="demo" type="text/html">
    <div class="layui-form-item">
    <label class="layui-form-label">会员账号</label>
    <div class="layui-input-block">
    <input type="text" name="l_account" autocomplete="off" class="layui-input layui-disabled" value="{{= d.l_bank_account }}" disabled="disabled" >
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">会员级别</label>
    <div class="layui-input-block">
    <input type="text" name="l_user_level" autocomplete="off" class="layui-input layui-disabled" value="{{d.l_user_level == 1?'报单中心':'普通会员'}}" disabled="disabled">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">会员姓名</label>
    <div class="layui-input-block">
    <input type="text" name="l_user_name" autocomplete="off" class="layui-input layui-disabled" value="{{d.l_user_name }}" disabled="disabled">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">手机号码</label>
    <div class="layui-input-block">
    <input type="text" name="l_user_phone" autocomplete="off" class="layui-input layui-disabled" value="{{d.l_user_phone }}" disabled="disabled">
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label">收货地址</label>
    <div class="layui-input-block">
    <input type="text" name="l_user_address" autocomplete="off" class="layui-input" value="{{# if (d.l_user_address == null) {''} }}">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">收货人姓名</label>
    <div class="layui-input-block">
    <input type="text" name="l_user_address_name" autocomplete="off" class="layui-input" value="{{d.l_user_name }}">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">收货人电话</label>
    <div class="layui-input-block">
    <input type="text" name="l_user_address_phone" autocomplete="off" class="layui-input" value="{{d.l_user_phone }}">
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">开户银行</label>
    <div class="layui-input-block">
    <select name="l_bank" lay-filter="">
    <option value="0">中国银行</option>
    <option value="1">中国建设银行</option>
    <option value="2">中国农业银行</option>
    <option value="3">中国工商银行</option>
    </select>
    </div>
    </div>
    <div class="layui-form-item">
    <label class="layui-form-label">开户行</label>
    <div class="layui-input-block">
    <input type="text" name="l_bank_account" value="{{d.l_bank_account }}" autocomplete="off" class="layui-input" placeholder="请输入开户行">
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label">复选框</label>
    <div class="layui-input-block">
    <input type="checkbox" name="like[write]" title="写作">
    <input type="checkbox" name="like[read]" title="阅读" checked>
    <input type="checkbox" name="like[dai]" title="发呆">
    </div>
    </div>

    <div class="layui-form-item">
    <label class="layui-form-label">银行卡号</label>
    <div class="layui-input-block">
    <input lay-verify="number" type="text" name="l_bank_cardNum" value="{{d.l_bank_cardNum }}" lay-verify="number" autocomplete="off" class="layui-input" placeholder="请输入银行卡号">
    </div>
    </div>
    <div class="layui-form-item">
    <div class="layui-input-block">
    <button class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
    <button type="reset" class="layui-btn layui-btn-primary">重置</button>
    </div>
    </div>
    </script>
    </form>
    </div>


    </div>
    </section>


    <script type="text/javascript" src="jsp/common/layui/layui.js"></script>
    <script type="text/javascript">
    layui.use('form', function(){
    var form = layui.form();
    alert(1);
    alert(JSON.stringify(form));
    layui.use('laytpl', function(){
    layui.use(['jquery'],function(){
    window.jQuery = window.$ = layui.jquery;
    $.getJSON("user/findById.do", function(data){
    // alert(JSON.stringify(data));
    var laytpl = layui.laytpl;
    var gettpl = document.getElementById("demo").innerHTML;
    laytpl(gettpl).render(data, function(html){
    document.getElementById("view").innerHTML = html;
    });
    });
    });
    });
    });

    </script>
    </body>
    </html>
    0 回复
  • 1253398319 1253398319
    2017-01-06 15:25:17
    @第一把菜刀 谢谢你 好了form.render();
    0 回复
最近热帖
完全基于 layui 开发的后台管理模板 2608
三层导航怎么做? 615
「源码市场」 正式版本上线 基于layui开发 546
2.0啥时候出啊,新项目要启动了 485
给2.0一些期待 416
麻烦朋友们投个票呗,FLY社区模板+thinkphp5驱动+个人DIY 367
layui整合datatable了么 301
ajax修改资料成功后 怎么进行初始化 页面刷新还是调用登录时的缓存 258
form.render('select') 更新渲染问题 229
select 动态操作不起作用,求助 195
近期热议
完全基于 layui 开发的后台管理模板 35
layui富文本编辑器图片上传无法回显 15
表单校验无效,找了好长时间找不到原因,求大神看下 14
select 动态操作不起作用,求助 10
ajax修改资料成功后 怎么进行初始化 页面刷新还是调用登录时的缓存 10
给2.0一些期待 9
如何给弹出层传参数? 8
文本编辑器出不来 8
laytpl不解析 8
content: 如果是调用本地的html,怎么写 7