x***@qq.com
x***@qq.com
  • 发布:2020-08-05 02:53
  • 更新:2020-08-11 15:57
  • 阅读:2564

【报Bug】微信小程序bug,更新data中的json时会出现残留子项

分类:uni-app

产品分类: uniapp/小程序/微信

PC开发环境操作系统: Mac

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

HBuilderX类型: 正式

HBuilderX版本号: 2.8.3

第三方开发者工具版本号: 微信开发者工具稳定版1.0.3

基础库版本号: 2.12.0

项目创建方式: HBuilderX

示例代码:
<template>  
    <view>  
        <view style="width: 100%;height: 100rpx;line-height:100rpx;background-color: #A0CFFF;text-align: center;" @click="month++">增加</view>  
        <view class="day item" v-for="(day,id) in filterDays" :key="'a'+id" :id="id">  
            {{day}}-{{id}}  
        </view>  
    </view>  
</template>  

<script>  
    export default{  
        data () {  
            return {  
                month: 5,  
                year: 2020  
            }  
        },  
        computed: {  
            filterDays () {  
                const totalDays = new Date(this.year, this.month, 0).getDate()  
                let temp = {}  
                for (let day = 1; day <= totalDays; day++) {  
                    const id = this.year.toString() + this.month.toString() + day.toString()  
                    temp[id] = day  
                }  
                return temp  
            }  
        }  
    }  
</script>  

<style>  
</style>

操作步骤:

在微信开发者工具运行上方代码
点击增加,第二次点击后出现bug

预期结果:

每次生成的新json应该完全清除覆盖之前的

实际结果:

之前的json有子项残留

bug描述:

用computed,watch或者methods里面的方法更新data中的json时会出现有些子项残留,h5正常,微信小程序上存在bug
在我的开发者工具,iOS13.5最新微信版本上均能100%复现。

下面提交的代码以computed为演示,实际上watch,methods均存在此bug。

2020-08-05 02:53 负责人:DCloud_UNI_GSQ 分享
已邀请:
x***@qq.com

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

DCloud_UNI_GSQ

DCloud_UNI_GSQ

bug确认,已加分,后续优化
临时解决方案:隐藏掉值为null的部分

DCloud_UNI_GSQ

DCloud_UNI_GSQ

问题关联:https://github.com/dcloudio/uni-app/issues/1882

该问题目前已经被锁定, 无法添加新回复