大神们,帮帮忙!【奖励丰厚!!!】

提问 已结
15 231
龙焱
龙焱 2017-10-12
悬赏:50飞吻
版本:独立版layer 浏览器:
用的是手机端的【Layer For Mobile2.0】 Select界面显示不出来!!!
代码如下:

<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
<title>测试</title>
<meta name="renderer" content="webkit">
<meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1,user-scalable=no">
<script type="text/javascript" src="layer.mobile-v2.0/layer_mobile/layer.js"></script>
<script type="text/javascript" src="https://cdn.bootcss.com/jquery/3.2.1/jquery.js"></script>
<link rel="stylesheet" href="layui/css/layui.css" />
<script type="text/javascript" src="layui/layui.js"></script>
</head>

<body class="main_body">
<div class="up-letv" id="j-btn-showhide">
测试
</div>
</body>

<script>
$(document).on('click', '#j-btn-showhide', function() {
layer.open({
title: [
'请填写信息',
'background-color:#8DCE16; color:#fff;'
],
content: '<form class="layui-form layui-form-pane" action="">' +
'<div class="layui-form-item">' +
' <label class="layui-form-label">近视眼</label>' +
'<div class="layui-input-inline">' +
'<select name="city" lay-verify="required">' +
'<option value=""></option>' +
'<option value="0">轴性</option>' +
'<option value="1">曲率性</option>' +
'<option value="2">屈光指数性</option>' +
'</select>' +
'</div>' +
'</div>' +
'</form>',
btn: '我知道了',
shadeClose: false,
yes: function() {
layer.open({
content: '好的',
time: 2,
skin: 'msg'
});
}
});
});
</script>
</html>
回帖
  • luoye
    2017-10-12
    给你重新写了,你改一下layui.css和layui.js的路径
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>test1</title>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css">
    <style type="text/css">
    .layui-layer-page .layui-layer-content{
    overflow: visible!important;
    }
    </style>
    </head>
    <body>
    <button type="button" id="btn" class="layui-btn">点我弹出窗口</button>
    <script type="text/javascript" src="layui/layui.js"></script>
    <script type="text/javascript">
    layui.use(["table","laytpl","form","layer"],function() {
    var table=layui.table,laytpl=layui.laytpl,form=layui.form,$=layui.jquery,layer=layui.layer;
    $("#btn").on("click",function() {
    layer.open({
    type:1,
    title: ['请填写信息','background-color:#8DCE16; color:#fff;'],
    content: '<form class="layui-form layui-form-pane" action="">' +
    '<div class="layui-form-item">' +
    ' <label class="layui-form-label">近视眼</label>' +
    '<div class="layui-input-inline">' +
    '<select name="city" lay-verify="required">' +
    '<option value=""></option>' +
    '<option value="0">轴性</option>' +
    '<option value="1">曲率性</option>' +
    '<option value="2">屈光指数性</option>' +
    '</select>' +
    '</div>' +
    '</div>' +
    '</form>',
    btn: '我知道了',
    shadeClose: false,
    yes: function() {
    layer.open({
    content: '好的',
    time: 2000
    });
    }
    ,success:function(layero, index) {
    form.render();
    }
    });
    });

    });
    </script>
    </body>
    </html>
    0 回复
  • luoye
    2017-10-12
    你没有重新渲染
    form.render("select");
    0 回复
  • luoye
    2017-10-12
    把下面这代码加进去就可以了
      success: function(layero, index){
    form.render();
    //console.log(layero, index);
    }
    0 回复
  • luoye
    2017-10-12
    而且你没有用layui.use
    layui.use(["form","jquery","layer"],function() {
    var $=layui.jquery,form=layui.form,layer=layui.layer;
    //在这里面写你的代码
    });
    0 回复
  • luoye
    2017-10-12
    还有,引入了layui.js,上面的layer.js和jquery.js就可以不用引入了
    通读官方文档,再去写代码
    0 回复
  • 龙焱
    2017-10-12
    @luoye 感谢,大神能不能帮忙写一个简单demo.只要能显示select就ok.再次感谢[嘻嘻]
    0 回复
  • luoye
    2017-10-12
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="utf-8">
    <title>test1</title>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css">
    </head>
    <body>
    <form class="layui-form" action="">
    <div class="layui-form-item">
    <div class="layui-inline">
    <label class="layui-form-label">搜索选择框</label>
    <div class="layui-input-inline">
    <select name="modules">
    <option value="">直接选择或搜索选择</option>
    <option value="1">layer</option>
    <option value="2">form</option>
    <option value="3">layim</option>
    <option value="4">element</option>
    <option value="5">laytpl</option>
    <option value="6">upload</option>
    <option value="7">laydate</option>
    </select>
    </div>
    </div>
    </div>
    </form>
    <script type="text/javascript" src="layui/layui.js"></script>
    <script type="text/javascript">
    layui.use(["table","laytpl","form","layer"],function() {
    var table=layui.table,laytpl=layui.laytpl,form=layui.form,$=layui.jquery,layer=layui.layer;

    });
    </script>
    </body>
    </html>
    layui.css和layui.js改为你自己的路径
    0 回复
  • 龙焱
    2017-10-12
    @luoye 好的,我这就试试看。
    0 回复
  • 龙焱
    2017-10-12
    @luoye 最好是在js里实现的 就如我最上边的代码一样
    0 回复
  • 龙焱
    2017-10-12
    @luoye 这段js会报错
    <script type="text/javascript">
    layui.use(["table", "laytpl", "form", "layer"], function() {
    var table = layui.table,
    laytpl = layui.laytpl,
    form = layui.form,
    $ = layui.jquery,
    layer = layui.layer;
    });
    </script>
    0 回复
  • luoye
    2017-10-12
    其中
    layui.use(["table","laytpl","form","layer"],function() {
    var table=layui.table,laytpl=layui.laytpl,form=layui.form,$=layui.jquery,layer=layui.layer;
    用不了那么多组件,可以这样写
    layui.use(["form","layer"],function() {
    var form=layui.form,$=layui.jquery,layer=layui.layer;
    0 回复
  • 龙焱
    2017-10-12
    @luoye 好的,非常感谢!
    0 回复
  • luoye
    2017-10-12
    @龙焱 之前这个帖子你不就发了吗
    http://fly.layui.com/jie/16206/
    0 回复
  • luoye
    2017-10-12
    @龙焱 要不把那个帖子回答了,你也结了啊?哈哈
    0 回复
  • 龙焱
    2017-10-12
    @luoye 写个移动端的demo 马上结[偷笑]
    0 回复