123qzo
123qzo
  • 发布:2021-11-16 16:58
  • 更新:2021-12-30 15:26
  • 阅读:540

【报Bug】ios hbuilderX 3.2.9 修改子包内容,热加载后 主包使用的refs ( this.$refs 在onReady nextTick 后调用) 获取为null 报错;

分类:HBuilderX

产品分类: HbuilderX

PC开发环境操作系统: Mac

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

HBuilderX版本号: 3.2.14

操作步骤:
<u-waterfall v-model="list" ref="uWaterfall"> <template v-slot:left="{ leftList }"> <view v-for="(item, index) in leftList" :key="index"> <wItem :info.sync="item"></wItem> </view> </template> <template v-slot:right="{ rightList }"> <view v-for="(item, index) in rightList" :key="index"> <wItem :info.sync="item"></wItem> </view> </template> </u-waterfall> onReady() { console.log(this.$refs); // 报错 }

预期结果:

refs 子组件加载正常; refs.xxx 为VueComponent

实际结果:

TypeError: Cannot read property 'selectAllComponents' of null

bug描述:

【报Bug】
ios hbuilderX 3.2.14
修改子包内容,热加载后 主包使用的refs ( this.$refs 在onReady nextTick 后调用) 获取为null 报错;

注: refs使用层级在二层;没有深层嵌套;

2021-11-16 16:58 负责人:无 分享
已邀请:
123qzo

123qzo (作者)

refs 不在内置组件使用

DCloud_UNI_LXH

DCloud_UNI_LXH

vue2还是vue3?具体是怎么使用的,贴一下看看。

yorker0503

yorker0503

的确有这个问题,我也遇到了,我是win10 ,HX3.2.12 , 热加载后,$refs就报 Cannot read property 'selectAllComponents' of null
不用热加载,重新编译就正常了

yorker0503

yorker0503

我用的vue2,代码如下:

onShow(){  
            console.log("index onShow")  
            //表示等组件全部加载完毕后执行  
            this.$nextTick(()=>{  
            	console.log("$nextTick")  
                console.log("this.$refs:",this.$refs) //热加载后,这里就报错,重新编译没问题  
                console.log("this.$refs.uWaterfall:",this.$refs.uWaterfall)  
            	// this.$refs.uWaterfall.clear()  
            })  
}

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