index.html 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE html>
  2. <html lang="zh">
  3. <head>
  4. <meta charset="UTF-8"/>
  5. <link rel="icon" href="/favicon.ico"/>
  6. <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
  7. <link rel="stylesheet" href="/plugins/element-plus/index.css"/>
  8. <link rel="stylesheet" href="/plugins/element-plus/theme-chalk/dark/css-vars.css"/>
  9. <link rel="stylesheet" href="/plugins/remixicon/remixicon.css"/>
  10. <link rel="stylesheet" href="/plugins/fonts/index.css"/>
  11. <title></title>
  12. </head>
  13. <body>
  14. <div id="app"></div>
  15. <script type="text/javascript" src="/plugins/uni.webview.1.5.5.js"></script>
  16. <script>
  17. //监听uni-app的事件
  18. window.appType = {};
  19. document.addEventListener('UniAppJSBridgeReady', () => {
  20. uni.getEnv(res => {
  21. window.appType = res;
  22. });
  23. //接受子页面传递过来的消息数据
  24. window.addEventListener('message', (event) => {
  25. if (event.data.source === 'web') {
  26. uni.postMessage({
  27. data: event.data
  28. });
  29. }
  30. });
  31. });
  32. //app改变显示模式
  33. function editTypeClick(type) {
  34. window?.postMessage({
  35. type: 'editTypeClick',
  36. source: 'app',
  37. data: type,
  38. })
  39. }
  40. //app的表单提交保存
  41. function formSave() {
  42. window?.postMessage({
  43. type: 'formSave',
  44. source: 'app',
  45. data: {},
  46. })
  47. }
  48. </script>
  49. <script type="module" src="/src/main.js"></script>
  50. </body>
  51. </html>