每一年都奔走在自己热爱里

 
没有人是一座孤岛,总有谁爱着你

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

父页面把选中行数据赋值给一个全局变量
8feb13f26b4ce87cf762913cdfc058df.png

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); 

              };

        

        })
posted @ 2021-04-13 17:35  与乐i  阅读(264)  评论(1编辑  收藏  举报
Live2D
// 生成目录索引列表 //侧边栏目录索引