Layui child parent page value transfer problem

Layui child parent page value transfer problem

  1. Passing values ​​from the parent page to the child page
    Define a method getData1() in the child page, and the parameter data is to receive the value passed from the parent page. As shown in the figure:
    Define the getData1() method on the subpage
    call the getData1() method of the subpage in the success method of the parent page, and pass the parameters to the subpage. As shown in the figure:
    The parent page calls the getData1() method
    In this way, the currentLocal of the parent page can be passed to the child page for use. Or you can splice the parameters after the url of the content.

  2. Passing values ​​from child pages to parent pages
    First, you can write a hidden field (such as a hidden input) on the child page and set the value to the hidden field. Then get the body content of the iframe page in the yes method of the parent page, and then get the value of the hidden field, so that the effect of passing the value from the child page to the parent page can be achieved. As shown in the picture:Pass value from child page to parent page

Guess you like

Origin blog.csdn.net/yuwenwenwenwenyu/article/details/102697500
Recommended