Table页面向Iframe子页面传值
Input赋值Radio赋值IMG赋值富文本XM-select赋值
table
.on('tool(currentTableFilter)', function (obj
) {
var data
= obj
.data
;
console
.log(data
);
if (obj
.event
=== 'edit') {
var index
= layer
.open({
title
: '编辑店铺信息',
type
: 2,
shade
: 0.2,
shadeClose
: true,
area
: ['100%', '100%'],
content
: '/shop/edit?id=' + data
.id
,
success
: function (layero
, index
) {
$
(layero
).addClass("scroll-wrapper");
let fbody
=layer
.getChildFrame('body',index
);
let fwindow
=window
[layero
.find('iframe')[0]['name']];
fbody
.find("input[name='shopId']").val(data
.id
);
fbody
.find("input[name='shopName']").val(data
.shopname
);
fbody
.find("input[name='address']").val(data
.address
);
fbody
.find("input[name='addressTag']").val(data
.addresstag
);
fbody
.find("input[name='stars']").val(data
.stars
);
fbody
.find("input[name='lessonScore']").val(data
.lessonscore
);
fbody
.find("input[name='teachScore']").val(data
.teachscore
);
fbody
.find("input[name='envScore']").val(data
.envscore
);
fbody
.find("input[name='openTime']").val(data
.opentime
);
fbody
.find("input[name='phoneNumber']").val(data
.phonenumber
);
fwindow
.layui
.form
.render();
}
});
$
(window
).on("resize", function () {
layer
.full(index
);
});
return false;
}else if (obj
.event
==='delete'){
console
.log('delete')
}
});
Input赋值
fbody
.find("input[name='openTime']").val(data
.opentime
);
fbody
.find("input[name='endTime']").val(timestampToTime(data
.endtime
));
Radio赋值
changeChildRadio(fbody
.find("input[name='state']"), data
.state
);
function changeChildRadio(input
, value
) {
for (let i in input
) {
let val
= input
.eq(i
).val();
if (val
== value
) {
input
.eq(i
).prop("checked", "checked");
break;
}
}
}
IMG赋值
fbody
.find("#img").attr('src', data
.titleimg
);
富文本
fwindow
.editor
.txt
.html(data
.content
);
fwindow
.layui
.form
.render();
XM-select赋值
let groupData
= (data
.groups
).split(",");
iframeWin
.groupSelect
.setValue(groupData
)
var groupSelect
= xmSelect
.render({
el
: document
.querySelector("#group"),
name
: 'groups',
layVerify
: 'required',
layVerType
: 'msg',
data
:[...]
})
转载请注明原文地址: https://lol.8miu.com/read-32.html