// 调用编辑器 var ue = UE.getEditor('editor'); layui.use(['form', 'layedit', 'laydate', 'upload'], function(){ var $ = layui.jquery var form = layui.form ,layer = layui.layer ,layedit = layui.layedit ,laydate = layui.laydate ,upload = layui.upload; //普通图片上传 var uploadInst = upload.render({ elem: '#test1' ,url: '/upload/' ,before: function(obj){ //预读本地文件示例,不支持ie8 obj.preview(function(index, file, result){ $('#demo1').attr('src', result); //图片链接(base64) }); } ,done: function(res){ //如果上传失败 if(res.code > 0){ return layer.msg('上传失败'); } //上传成功 } ,error: function(){ //演示失败状态,并实现重传 var demoText = $('#demoText'); demoText.html('上传失败 重试'); demoText.find('.demo-reload').on('click', function(){ uploadInst.upload(); }); } }); //日期 laydate.render({ elem: '#date' }); laydate.render({ elem: '#date1' }); //监听提交 form.on('submit(demo1)', function(data){ layer.alert(JSON.stringify(data.field), { title: '最终的提交信息' }) return false; }); var html = ""; $.ajax({ url: "video.json", type: "GET", dataType: "json", success: function(data) { $.each(data.markerArr, function (i, data) { //左边楼盘列表 html+= ''; }) $("select[name='address']").append(html); // console.log(html) form.render('select'); } }); });