罗广辉
2025-10-14 6504aa31ded7bcdb2d03b4c40f58e60b435d6099
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
<!-- 已执行 -->
<template>
  <web-view ref="sWebViewRef" :src="`${viewUrl}`" @message="onPostMessage" @onPostMessage="onPostMessage" />
</template>
 
<script setup>
import {onLoad} from "@dcloudio/uni-app";
import {useUserStore} from "@/store/index.js";
 
const sWebViewRef = ref(null);
const userStore = useUserStore();
let viewUrl = ''
 
function onPostMessage(event) {
  if (event.detail.data[0].type === 'back') {
    // active.value = null
  }
}
 
// onLoad(() => {
//   window.addEventListener('message', function (e) {
//     if (e.data.data.type === 'back') {
//       // active.value = null
//     }
//   });
// })
 
onLoad((options) => {
  // console.log('options1111111', JSON.parse(decodeURIComponent(options)));
  const id=3333
  viewUrl = `http://192.168.1.178:5173/drone-app-web-view/#/webViewWrapper/execution?rowItem=${id}`;
});
</script>
 
<style lang="scss" scoped></style>