<tfoot id='qQ0Fi'></tfoot>
    • <bdo id='qQ0Fi'></bdo><ul id='qQ0Fi'></ul>

    1. <small id='qQ0Fi'></small><noframes id='qQ0Fi'>

      1. <i id='qQ0Fi'><tr id='qQ0Fi'><dt id='qQ0Fi'><q id='qQ0Fi'><span id='qQ0Fi'><b id='qQ0Fi'><form id='qQ0Fi'><ins id='qQ0Fi'></ins><ul id='qQ0Fi'></ul><sub id='qQ0Fi'></sub></form><legend id='qQ0Fi'></legend><bdo id='qQ0Fi'><pre id='qQ0Fi'><center id='qQ0Fi'></center></pre></bdo></b><th id='qQ0Fi'></th></span></q></dt></tr></i><div id='qQ0Fi'><tfoot id='qQ0Fi'></tfoot><dl id='qQ0Fi'><fieldset id='qQ0Fi'></fieldset></dl></div>

        <legend id='qQ0Fi'><style id='qQ0Fi'><dir id='qQ0Fi'><q id='qQ0Fi'></q></dir></style></legend>

        layer.open获取数据以及回显实例代码

        list页面配置 // 行事件绑定 table.on('tool(test)', function (obj) { var data = obj.data; if (obj.event === "edit") { //eg2 layer.open({ title: '修改分类' , type: 2 , btn: ['提交'] , content: 'edit.html' , area: ['720px', '680px'] , shadeClos
        • <bdo id='upLZQ'></bdo><ul id='upLZQ'></ul>
            <tbody id='upLZQ'></tbody>

          <small id='upLZQ'></small><noframes id='upLZQ'>

        • <legend id='upLZQ'><style id='upLZQ'><dir id='upLZQ'><q id='upLZQ'></q></dir></style></legend>

            <i id='upLZQ'><tr id='upLZQ'><dt id='upLZQ'><q id='upLZQ'><span id='upLZQ'><b id='upLZQ'><form id='upLZQ'><ins id='upLZQ'></ins><ul id='upLZQ'></ul><sub id='upLZQ'></sub></form><legend id='upLZQ'></legend><bdo id='upLZQ'><pre id='upLZQ'><center id='upLZQ'></center></pre></bdo></b><th id='upLZQ'></th></span></q></dt></tr></i><div id='upLZQ'><tfoot id='upLZQ'></tfoot><dl id='upLZQ'><fieldset id='upLZQ'></fieldset></dl></div>
            <tfoot id='upLZQ'></tfoot>
                • list页面配置
                  // 行事件绑定
                   table.on('tool(test)', function (obj) {
                              var data = obj.data;
                              if (obj.event === "edit") {
                                  //eg2
                                  layer.open({
                                      title: '修改分类'
                                      , type: 2
                                      , btn: ['提交']
                                      , content: 'edit.html'
                                      , area: ['720px', '680px']
                                      , shadeClose: false
                                      , move: false
                                      , scrollbar: false
                                      , success: function (layero, index) {
                                          // 数据回显
                                          var body = layer.getChildFrame('body', index);
                                          body.find('input[name="title"]').val(data.title);
                                          body.find('input[name="sort"]').val(data.sort);
                                          body.find('input[name="imgUrl"]').val(data.imgUrl);
                                          body.find('textarea[name="remark"]').val(data.remark);
                                          body.find('select[name="stated"]').val(data.stated);
                                          body.find('select[name="pageCode"]').val(data.pageCode);
                                          body.find('input[name="outUrl"]').val(data.outUrl);
                                          body.find('img[id="demo1"]').attr("src",imgUrl+data.imgUrl);
                                      }
                                      , yes: function (index, layero) {
                                          // 点击确定后获取弹窗数据
                                          var body = layer.getChildFrame('body', index);
                                          let title = body.find('input[name="title"]')[0].value;
                                          let sort = body.find('input[name="sort"]')[0].value;
                                          let imgUrl = body.find('input[name="imgUrl"]')[0].value;
                                          let remark = body.find('textarea[name="remark"]')[0].value;
                                          let stated = body.find('select[name="stated"]')[0].value;
                                          let pageCode = body.find('select[name="pageCode"]')[0].value;
                                          let outUrl = body.find('input[name="outUrl"]')[0].value;
                                          if (title.length < 1) {
                                              layer.msg("请输入轮播图名称");
                                              return false;
                                          }
                                          if (imgUrl.length < 8) {
                                              layer.msg("请上传图片");
                                              return false;
                                          }
                                          if (imgUrl.length < 8) {
                                              layer.msg("请上传图片");
                                              return false;
                                          }
                                          $.ajax({
                                              url: url + "/sys/b/update"
                                              , type: "post"
                                              , data: {
                                                  token: localStorage.getItem("token"),
                                                  id: data.id,
                                                  title: title,
                                                  sort: sort,
                                                  imgUrl: imgUrl,
                                                  stated: stated,
                                                  pageCode: pageCode,
                                                  outUrl: outUrl,
                                                  remark: remark
                                              },
                                              success: function (res) {
                                                  layer.msg(res.message, {time: 1500}, function () {
                                                      if (res.code == "200") {
                                                          layer.closeAll();
                                                          window.location.reload();
                                                      } else if (res.code == "201") {
                                                          window.location = "../login.html";
                                                      }
                                                  })
                                              }
                                          })
                                      },
                                      cancel: function () {
                                          //右上角关闭回调
                                          layer.msg("已取消",{time:1500},function () {
                                              layer.closeAll();
                                          });
                                      }
                                  });
                              } else if (obj.event === "del") {
                                  layer.confirm("确定删除么?", {
                                      btn: ["确定", "取消"]
                                  }, function () {
                                      $.ajax({
                                          url:url+"/sys/b/del",
                                          type:"post",
                                          data:{
                                              token:localStorage.getItem("token"),
                                              id:data.id
                                          },
                                          success:function (res) {
                                              layer.msg(res.message, {time: 1500}, function () {
                                                  if (res.code == "200") {
                                                      layer.closeAll();
                                                      window.location.reload();
                                                  } else if (res.code == "201") {
                                                      window.location = "../login.html";
                                                  }
                                              })
                                          }
                                      })
                                  })
                              }
                          })
                  弹框数据
                  <form class="layui-form" >
                      <div class="layui-form-item">
                          <label class="layui-form-label">标题</label>
                          <div class="layui-input-inline">
                              <input type="text" name="title" value="" placeholder="标题" maxlength="10"
                                     autocomplete="off" class="layui-input">
                          </div>
                          <label class="layui-form-label">排序</label>
                          <div class="layui-input-inline">
                              <input type="number" name="sort" value="0" placeholder="排序" maxlength="10"
                                     autocomplete="off" class="layui-input">
                          </div>
                      </div>
                      <div class="layui-form-item">
                          <label class="layui-form-label">位置</label>
                          <div class="layui-input-inline">
                              <select name="pageCode" lay-filter="page_code" id="page_code">
                                  <option value="HOME_PAGE">首页</option>
                              </select>
                          </div>
                          <label class="layui-form-label">展示/隐藏</label>
                          <div class="layui-input-inline">
                              <select name="stated" lay-filter="stated" id="stated">
                                  <option value="1">展示</option>
                                  <option value="0">隐藏</option>
                              </select>
                          </div>
                      </div>
                      <div class="layui-form-item">
                          <label class="layui-form-label">链接</label>
                          <div class="layui-input-inline">
                              <input type="text" name="outUrl" value="" placeholder="请输入链接" maxlength="10"
                                     autocomplete="off" class="layui-input">
                          </div>
                      </div>
                      <div class="layui-form-item">
                          <label class="layui-form-label">图</label>
                          <div class="layui-input-inline">
                              <div class="layui-upload">
                                  <button type="button" class="layui-btn" id="test1">上传图片</button>
                                  <div class="layui-upload-list">
                                      <img class="layui-upload-img" id="demo1" style="width: 200px;height: 175px;margin-top: 8px">
                                      <input type="hidden" name="imgUrl" id="imgUrl">
                                  </div>
                              </div>
                          </div>
                      </div>
                      <div class="layui-form-item">
                          <label class="layui-form-label">备注</label>
                          <div class="layui-input-inline">
                              <textarea placeholder="请输入内容最多150个字符" maxlength="150" style="width: 350px;height: 180px;resize: none" name="remark" class="layui-textarea"></textarea>
                          </div>
                      </div>
                  </form>
                  <link rel="stylesheet" href="../../lib/layui-v2.5.5/css/layui.css" media="all">
                  <script src="../../lib/layui-v2.5.5/layui.js" charset="utf-8"></script>
                  <script src="../../js/jquery/dist/jquery.js" charset="utf-8"></script>
                  <script src="../../js/common.js" charset="utf-8"></script>
                  <!-- 注意:如果你直接复制所有代码到本地,上述 JS 路径需要改成你本地的 -->
                  <script>
                      // 加载需要的组件如:上传、日期等
                      //常规使用 - 普通图片上传
                      layui.use(['upload','form'], function () {
                          var upload = layui.upload;
                          var form = layui.form;
                          form.render();
                          upload.render({
                              elem: '#test1'
                              , size: 1024 * 1204
                              , exts: 'png|jpg|jpeg' //只允许上传压缩文件
                              , url: url + '/upload?token=' + localStorage.getItem("token") //改成您自己的上传接口
                              , before: function (obj) {
                                  //预读本地文件示例,不支持ie8
                                  obj.preview(function (index, file, result) {
                                      $('#demo1').attr('src', result); //图片链接(base64)
                                  });
                                  layer.msg('上传中', {icon: 16, time: 0});
                              }
                              , done: function (res) {
                                  layer.msg(res.message, {time: 1500}, function () {
                                      $("#imgUrl").val(res.data);
                                  })
                              }
                          });
                      });
                   
                  </script>
                  如果需要对编辑器进行数据回显:一定要在build之前进行赋值
                   var detailHtml = localStorage.getItem("detailHtml");
                    $("#detail_area").val(detailHtml);
                    let index= layedit.build('detail_area', {});
                   
                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  可以通过 table.reload 方法中的参数 done 回调函数来获取到表格主体的高度。示例代码如下: layui.use('table', function(){ var table = layui.table; //执行渲染 table.render({ elem: '#table1', url: '/demo/table/user/', cols: [[ {field:'id', title:
                  layui.open 通过get和post方式提交数据的两种方式,示例代码如下,希望可以帮到您。 1.layui.open原生是通过get提交数据的: var url = "/train/class/stage?" + jQuery.param(stage); window.layerIndex = layer.open({ type: 2, title: "编辑阶段", shadeCl
                  layer.open让弹窗的按钮居中的示例代码 layer.open({ title:"提示", type:1, area:['500px','500px'], btn:"提交", btnAlign:"c",//btnAlign:c属性按钮居中,l居左边,r居右边,属性必须小写,大写是无效的! content:`` });
                  最近使用layui做了个简单的项目,遇到了个问题,在layui.table渲染页面做修改的时候,使用的是弹出层,要把值赋给radio的时候总是渲染不上去。现在解决了这个问题,记录一下。 js代码块代码: function updateUser(data) { layer.open({ type : 2, title : '
                  具体代码如下,我想获取到select中,option中的选项值和value值,要怎么写代码呢? form class="layui-form"div class="layui-form-item"label class="layui-form-label"分类/labeldiv class="layui-input-inline"select lay-filter="fenlei" class="ffff"opt
                  layui如何获取select选中的值,下面代码为您实现layui table中获取select选中值 select name="region" lay-filter="region-dropdown" option value="ap-chengdu"成都/option option value="ap-nanjing"南京/option option value="ap-beijing-1"北京一区/optio
                    <tbody id='1ocmU'></tbody>

                    <i id='1ocmU'><tr id='1ocmU'><dt id='1ocmU'><q id='1ocmU'><span id='1ocmU'><b id='1ocmU'><form id='1ocmU'><ins id='1ocmU'></ins><ul id='1ocmU'></ul><sub id='1ocmU'></sub></form><legend id='1ocmU'></legend><bdo id='1ocmU'><pre id='1ocmU'><center id='1ocmU'></center></pre></bdo></b><th id='1ocmU'></th></span></q></dt></tr></i><div id='1ocmU'><tfoot id='1ocmU'></tfoot><dl id='1ocmU'><fieldset id='1ocmU'></fieldset></dl></div>

                    • <small id='1ocmU'></small><noframes id='1ocmU'>

                        <bdo id='1ocmU'></bdo><ul id='1ocmU'></ul>
                          <tfoot id='1ocmU'></tfoot>

                          • <legend id='1ocmU'><style id='1ocmU'><dir id='1ocmU'><q id='1ocmU'></q></dir></style></legend>