splice删除数组的时候出现BUG,逻辑层和视图层不同步。

小程序 文章 2022-04-01 17:20 516 0 全屏看文

AI助手支持GPT4.0

splice删除数组的时候出现BUG,逻辑层和视图层不同步。There is a bug when splice deletes the array, and the logic layer and the view layer are out of sync.

splice删除数组的时候出现BUG,逻辑层和视图层不同步。
框架类型 问题类型 终端类型 微信版本 基础库版本
小程序 Bug 微信安卓客户端 8.0.20 2.23.3

删除数组后逻辑层已经执行完毕,但是视图层没有渲染。

delArr(options){  var index = options.currentTarget.dataset.index;  var step = this.data.step;  step.splice(index,1);  this.setData({step:step});}


Framework type problem type terminal type wechat version basic library version applet bug wechat Android client 8.0.20 2.23.3 after deleting the array, the logical layer has been executed, but the view layer has not been rendered. delArr(options){ var index = options.currentTarget.dataset.index;  var step = this.data.step;  step.splice(index,1);  this.setData({step:step});}

回答:

武曲心:

var step = JSON.parse(JSON.stringify(this.data.step))

呵呵:

打印一下index,发个代码片段吧

Mr.Zhao:

工具和安卓都试了,没问题

-EOF-

AI助手支持GPT4.0