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

已采纳
6 187
  • 第一把菜刀 第一把菜刀
    2017-01-06 15:10:40
    是这样的吧:laytpl渲染之后才出现的html,有html之后你再去渲染select就出来了
    0 回复
  • 1253398319 1253398319
    2017-01-06 14:28:42
    页面效果没有下拉列表...
    0 回复
  • Blogcommunity Blogcommunity
    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 1.0.8 发布,一次用心的小版本升级 4877
LayIM 发布 3.0.3,增加音频消息支持及移动端联系人界面 1295
thinkphp5.0+layui个人博客源码分享,也可以做cms 1118
基于LayUI的后台管理模板BeginnerAdmin更新啦~~~~~~~~~~~~~~ 439
Layer真心好用,有了它,我作为一个phper终于有信心抛开二次开发 278
layui不好用啊,好复杂啊 255
layui 三级联动 245
有偿求助作者大大,我有一个opencart商城网站,想集成layui的问答系统 233
不得不承认,非常棒的一个富文本编辑器 189
ThinkPHP基于Layui无刷提交数据表单,亲测可用 181
layim下载
近期热议
layui 1.0.8 发布,一次用心的小版本升级 54
LayIM 发布 3.0.3,增加音频消息支持及移动端联系人界面 21
layui不好用啊,好复杂啊 13
通过ajax动态生成的新checkbox添加到table里面样式不存在了,怎么才能重新渲染? 13
基于LayUI的后台管理模板BeginnerAdmin更新啦~~~~~~~~~~~~~~ 12
layui的进度条总是无法显示 10
layer.confirm弹出之后的keydown事件 10
关于富文本框的内容清空问题 10
thinkphp5.0+layui个人博客源码分享,也可以做cms 9
请问layui的tab切换,防止页面刷新效果重置是怎么实现的? 8