当前位置:网站首页>layer. Open processing method when the passed value is an array or the value is too long
layer. Open processing method when the passed value is an array or the value is too long
2022-06-30 08:18:00 【BlizzardWu】
var data = [{
"name":"160A100A1638.jpg","url":"/public/uploads/160A100A1638.jpg"}];
layer.open({
title: " Subpage ",
type: 2,
content: "/admin/sysconfig/terminal_qrcodelist",
area: ['50%', '70%'],
btn: [" One click download ",' close '],
success: function (layero, index) {
// Successfully loaded changefile.html when , Preload , Pass the value from the parent window to child window
let body = layer.getChildFrame('body', index); // Without this, you can't pass values from the parent page to the child page
// Get the elements of the sub page , Render the data
// body.find(".filename").val(data[0].name); // adopt class Name to get data
// body.find(".filepath").val(data[0].url);// It means that rowselect[0].path This value is passed to the child window class="filepath" In this text box ,( Preload )
// Preload some sub page content
var html = '';
data.forEach(function(value, key, data) {
html += '<div class="big_box"><div class="img_box"><img src="'+ value.url +'" style="width:100%;" ></div>'+
'<div class="btn_box"><a href="'+ value.url +'" download="'+ value.name +'" class="btn layui-btn-normal radius"> download </a></div></div>';
//console.log(value.url);
});
body.find("#qr_list").html('');
body.find("#qr_list").html(html);
// layui.form.render();
},
yes: function (index, layero) {
// When the OK button of the pop-up layer is pressed , This is to get the child window in the parent window form All values in the tag , And according to name Names and values form key value pairs json object
// Loop Download all qrcode
$.each(data, function (i ,item){
let a = document.createElement('a') // establish a label
let e = document.createEvent('MouseEvents') // Create a mouse event object
e.initEvent('click', false, false) // Initialize event object
a.href = item.url // Set download address
a.download = item.name // Set the download file name
a.dispatchEvent(e)
});
},
btn2: function (index, layero) {
//layer.close(index);
location.reload();
}
});
边栏推荐
- [nvme2.0b 14-7] set features (Part 1)
- Opencv image
- Qqquickpainteditem implements graffiti program drawing board
- php api获取二维码、组合生成图片
- This point in JS
- [JUC series] overview of fork/join framework
- Niuke White Moon race 52
- Experiment 6 examination
- [flower carving experience] 14 line blank board pingpong library test external sensor module (one)
- Swagger use
猜你喜欢

【NVMe2.0b 14-1】Abort、Asynchronous Event Request、Capacity Management command

How to handle the expired data of redis and what are the elimination mechanisms?

Redis设计与实现(三)| 服务器与客户端的交互(事件IO模型)

Is it difficult to jump job ByteDance? With these skills, you can easily pass

微信公众号第三方平台开发,零基础入门。想学我教你啊

【NVMe2.0b 14-3】Doorbell Buffer Config command、Device Self-test command

An example of a single service in a cloud project driven by a domain

Deep learning -- language model and sequence generation

领域驱动下cloud项目中单个服务的示例

F12抓包用于做postman接口测试的全过程解析
随机推荐
QT event cycle
【NVMe2.0b 14-4】Directive Send/Receive command
Development technology sharing of Jingtan NFT digital collection system
How CRM & PM helps enterprises create optimal sales performance
How to handle the expired data of redis and what are the elimination mechanisms?
安科瑞高等学校校园建筑节能监管系统建设
String and underlying character types of go data type
Bingbing learning notes: quick sorting
云服务器上部署仿牛客网项目
跳槽字节跳动很难嘛?掌握这些技巧,你也能轻松通过
Unity简单shader
Construction of energy conservation supervision system for campus buildings of ankery University
Want to ask, how to choose securities companies for stock speculation? Is it safe to open an account online?
Cesium learning notes (I)
More, faster, better and cheaper. Here comes the fastdeploy beta of the low threshold AI deployment tool!
【NVMe2.0b 14-3】Doorbell Buffer Config command、Device Self-test command
Redis 的过期数据如何处理,淘汰机制都有那些?
Experiment 6 examination
JS code case
微信小程序使用vant weapp报错