3***@qq.com
3***@qq.com
  • 发布:2024-01-19 10:07
  • 更新:2024-01-19 10:07
  • 阅读:445

【报Bug】app打包自定义基座后运行报错。安卓正常。

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: Windows 10 教育版 内部版本号19045.3570

HBuilderX类型: 正式

HBuilderX版本号: 3.99

手机系统: iOS

手机系统版本号: iOS 17

手机厂商: 苹果

手机机型: 苹果15

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
export default {  
        data() {  
            return {  
            }  
        },  
        methods: {  
            scanCode() {  
                const app = getApp();  
                let that = this;  
                // 只允许通过相机扫码  
                uni.scanCode({  
                    onlyFromCamera: true,  
                    success: function(res) {  
                        let qrcode = "";  
                        if (res.result) {  
                            qrcode = res.result.replace(  
                                app.globalData.QrRuleBaseInfo,  
                                ""  
                            );  
                        }  
                        let Array = res.result.split("sign=");  
                        app.SetSaveData("sign", Array[1]);  
                        app.navigationTo("/pages/AppStart/AppStart", 2);  
                    }  
                });  
            }  
        }  
    }

操作步骤:

vue页面放代码示例代码,打包ios自定义基座,运行

预期结果:

不报错,点击扫码按钮,调用scanCode方法。进入扫码页。

实际结果:

直接报错
[JS Framework] Failed to execute the callback function:[ERROR] : [JS Framework] Failed to execute the callback function:TypeError: this.$refs.barcode.cancel is not a function. (In 'this.$refs.barcode.cancel()', 'this.$refs.barcode.cancel' is undefined) __ERROR

bug描述:

[JS Framework] Failed to execute the callback function:[ERROR] : [JS Framework] Failed to execute the callback function:TypeError: this.$refs.barcode.cancel is not a function. (In 'this.$refs.barcode.cancel()', 'this.$refs.barcode.cancel' is undefined) __ERROR

扫码调用的uniapp内置uni.scanCode
1、使用标准基座运行正常,自定义基座才报错。
2、安卓标准基座,自定义基座都正常。

2024-01-19 10:07 负责人:无 分享
已邀请:

要回复问题请先登录注册