首页 > 编程语言 > 详细

【】SpringBoot-LayUI之父子页面数据传递

时间:2021-04-14 00:18:53      阅读:31      评论:0      收藏:0      [点我收藏+]

父页面把选中行数据赋值给一个全局变量
技术分享图片

if (obj.event === ‘edit‘) {        layui.use(‘layer‘, function() {

                                                             json=data;

                                                            layer.open({

                                                                  title 
: ‘编辑‘,

                                                                  maxmin 
: true,

                                                                  type : 
2,

                                                                  content : ‘./editUser.html‘,

                                                                  area : 
[ ‘800px‘, ‘500px‘ ],

                                                                  success : function(layer, index) {

                                                                        //表格重载

                                                                        table.reload(‘testReload‘, {

                                                                                url: ‘/user/list‘

                                                                              });

                                                                  }

                                                            });

                                                      });


子页面从全局变量接受数据在赋值给详情页

  //监听修改

      var jsonData;

        $(function () {

              jsonData = eval(parent.json);//这个是获取父页面中全局变量的值(是json格式的)

              console.log("-------"+JSON.stringify(jsonData))

              if(jsonData){          

                    form.val("userForm", {

                      ‘id‘: jsonData.id,

                      ‘username‘:jsonData.username,

                      ‘realname‘:jsonData.realname,

                      ‘birthday‘:jsonData.birthday,

                      ‘sex‘:jsonData.sex,

                      ‘phone‘:jsonData.phone,

                      ‘email‘:jsonData.email,

                      });

                    var src="/user/showFile/"+jsonData.column1;

                     $(‘#demoImg‘).attr(‘src‘, src); 

              };

        

        })

【】SpringBoot-LayUI之父子页面数据传递

原文:https://www.cnblogs.com/linanana/p/14654384.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!