5***@qq.com
5***@qq.com
  • 发布:2024-01-17 17:31
  • 更新:2024-01-17 17:31
  • 阅读:81

uniapp开发Vu3打包wgt安卓运行:change:prop 直接白屏

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 10

HBuilderX类型: 正式

HBuilderX版本号: 3.99

手机系统: Android

手机系统版本号: Android 11

手机厂商: 红米

手机机型: 9A

页面类型: vue

vue版本: vue3

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template>  
    <view id="map-container"  
        :prop="isLocation"  
        :change:prop="mapModule.geolocation"  
    >  

    </view>  
</template>  

<script>  
import { onMounted, ref, reactive, defineComponent, toRefs, watch } from 'vue';  
export default defineComponent({  
    setup() {  
        const state = reactive({  
            isLocation: false  
        })  
        onMounted(() => {  
            setTimeout(() => (state.isLocation = true), 2000)  
        })  
        function showToast(data) {  
            uni.showToast({  
                title: data,  
                icon: 'none'  
            })  
        }  
        return {  
            ...toRefs(state),  
            showToast  
        }  
    }  
})  
</script>  
<script module="mapModule" lang="renderjs">  
    export default {  
        data () {  
            return {  
                map: null  
            }  
        },  
        methods: {  
            geolocation(newLocation, oldLocation) {  
                const that = this;  
                that.$ownerInstance && that.$ownerInstance.callMethod("showToast", '进入了')  
            }  
        }  
    }  
</script>

这样运行直接白屏

<template>  
    <view>  
        <view @click="mapModule.geolocation">  
            点击通讯  
        </view>  
        <view id="map-container" :prop="isLocation" > </view>  
    </view>  

</template>  

<script>  
import { onMounted, ref, reactive, defineComponent, toRefs, watch } from 'vue';  
export default defineComponent({  
    setup() {  
        const state = reactive({  
            isLocation: false  
        })  
        onMounted(() => {  
            setTimeout(() => (state.isLocation = true), 2000)  
        })  
        function showToast(data) {  
            uni.showToast({  
                title: data,  
                icon: 'none'  
            })  
        }  
        return {  
            ...toRefs(state),  
            showToast  
        }  
    }  
})  
</script>  
<script module="mapModule" lang="renderjs">  
    export default {  
        data () {  
            return {  
                map: null  
            }  
        },  
        methods: {  
            geolocation(newLocation, oldLocation) {  
                const that = this;  
                that.$ownerInstance && that.$ownerInstance.callMethod("showToast", '进入了')  
            }  
        }  
    }  
</script>

这样就可以

操作步骤:

<view id="map-container" :prop="isLocation" :change:prop="mapModule.geolocation"></view>

预期结果:

<view id="map-container" :prop="isLocation" :change:prop="mapModule.geolocation"></view> 能够正常渲染

实际结果:

无法渲染

bug描述:

uniapp开发Vu3打包wgt安卓运行:change:prop 直接白屏无法渲染
去掉:change:prop 改为 用户主动click唤起renderjs的方法就能正常渲染 并能正常交互

2024-01-17 17:31 负责人:无 分享
已邀请:

要回复问题请先登录注册