局外人123
局外人123
  • 发布:2025-04-11 10:39
  • 更新:2025-04-11 11:56
  • 阅读:58

【报Bug】vue2版本Android端instanceof判断响应式数组返回结果不正确

分类:uni-app

产品分类: uniapp/App

PC开发环境操作系统: Windows

PC开发环境操作系统版本号: 23H2(0S内郚版本22631.4169)

HBuilderX类型: 正式

HBuilderX版本号: 4.61

手机系统: Android

手机系统版本号: Android 11

手机厂商: 小米

手机机型: 红米k70pro

页面类型: vue

vue版本: vue2

打包方式: 云端

项目创建方式: HBuilderX

示例代码:
<template>  
    <view class="content">  
        <image class="logo" src="/static/logo.png"></image>  
        <view class="text-area">  
            <text class="title">{{ title }}</text>  
        </view>  
    </view>  
</template>  

<script>  
export default {  
    data() {  
        return {  
            title: 'Hello',  
            array: ['scooter-zd', 'scooter-town']  
        };  
    },  
    onLoad() {  
        console.log(this.array instanceof Array);  
    },  
    methods: {}  
};  
</script>  

<style>  
.content {  
    display: flex;  
    flex-direction: column;  
    align-items: center;  
    justify-content: center;  
}  

.logo {  
    height: 200rpx;  
    width: 200rpx;  
    margin-top: 200rpx;  
    margin-left: auto;  
    margin-right: auto;  
    margin-bottom: 50rpx;  
}  

.text-area {  
    display: flex;  
    justify-content: center;  
}  

.title {  
    font-size: 36rpx;  
    color: #8f8f94;  
}  
</style>  

操作步骤:

运行到app端

预期结果:

打印true

实际结果:

打印false

bug描述:

vue2版本,在app端,instanceof判断响应式数组是否属于Array会返回false,h5端和vue3版本不会

2025-04-11 10:39 负责人:无 分享
已邀请:
DCloud_UNI_JBB

DCloud_UNI_JBB

晚会排查下

DCloud_UNI_JBB

DCloud_UNI_JBB

应该是原型链的问题,可以先用其他方法比如 Array.isArray

要回复问题请先登录注册