tttt.html 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8" />
  5. <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  6. <title>Document</title>
  7. </head>
  8. <body>
  9. <button id="btn">子页面按钮-触发彩蛋</button>
  10. <button id="hidden">隐藏右测图标</button>
  11. <button id="show">显示右测图标</button>
  12. </body>
  13. <script>
  14. window.sonGetListFu = (val, code) => {
  15. console.log('子页面接受父页面传过来的数据,', val, code)
  16. // [
  17. // // 数据格式
  18. // {
  19. // imgUrl:
  20. // 'https://xxxxxx',
  21. // flag: true, 表示彩蛋已经解锁
  22. // name: '第一天-三级任务1',
  23. // id: '08c636aa444d4f6ba4a048370848febe',
  24. // sort: 1 拿sort当id
  25. // }
  26. // ...
  27. // ]
  28. }
  29. window.sonEggUpFu = id => {
  30. console.log('子页面接受父页面-关闭彩蛋', id)
  31. }
  32. const btnDom = document.querySelector('#btn')
  33. btnDom.onclick = () => {
  34. // 传sort
  35. window.parent.FaStrikeEggFu(1)
  36. window.parent.FaStrikeEggFu(1)
  37. window.parent.FaStrikeEggFu(1)
  38. window.parent.FaStrikeEggFu(1)
  39. }
  40. const hiddenDom = document.querySelector('#hidden')
  41. hiddenDom.onclick = () => {
  42. window.parent.FaIconStateFu(false)
  43. }
  44. const showDom = document.querySelector('#show')
  45. showDom.onclick = () => {
  46. window.parent.FaIconStateFu(true)
  47. }
  48. </script>
  49. </html>