7***@qq.com
7***@qq.com
  • 发布:2025-06-11 18:34
  • 更新:2025-06-13 16:56
  • 阅读:50

应用切到后台再返回会导致webview刷新的问题有人遇到过吗,比如webview调起摄像头拍照或者回到桌面在进入应用

分类:uni-app x

应用切到后台再返回会导致webview刷新的问题有人遇到过吗,比如webview调起摄像头拍照或者回到桌面在进入应用

2025-06-11 18:34 负责人:无 分享
已邀请:
DCloud_UNI_yuhe

DCloud_UNI_yuhe

我这里测试从后台再进入没有刷新,可能是你代码有刷新的逻辑,或者提供一下辅助排查的视频

  • 7***@qq.com (作者)

    下面回复提供了代码。 视频附件上传不了,有邮箱或者群吗

    2025-06-13 16:50

7***@qq.com

7***@qq.com (作者)

uni代码

<template>  
    <view>  
        <web-view style="width: 100%;height:600rpx" src="http://192.168.2.254:5173/"></web-view>  
    </view>  
</template>  

<script>  
    export default {  
        data() {  
            return {  

            }  
        },  
        methods: {  

        }  
    }  
</script>  

<style>  

</style>  

webview代码


<template>  
  <img v-for="item in imgList" :src="item?.httpUrl" alt="">  
  <input type="file" @change="onFileChange">  
</template>  
<script setup>  
import {ref} from "vue"  
import axios from "axios"  
const imgList = ref([])  
const onFileChange = (e) => {  
  console.log(e.target.files[0])  
  let _formData = new FormData();  
  _formData.append("type", '现场照片');  
  _formData.append("file", e.target.files[0]);  
  axios.post('图片上传地址',_formData,{  
    headers:{  
      'Content-Type': 'multipart/form-data',  
    }  
  }).then(response => {  
    imgList.value.push(response.data.data)  
    console.log('上传成功:', response.data); // 处理成功响应  
  })  
}  
</script>  
<style>  
img{  
  width: 100px;  
  height: 100px;  
}  
</style>
7***@qq.com

7***@qq.com (作者)


测试视频转的gif

  • DCloud_UNI_yuhe

    你这怎么看出来webview刷新了?

    2025-06-13 16:58

要回复问题请先登录注册