vue TypeError: Cannot read properties of undefined (reading ‘key‘)

我遇到的情况是有一个下拉框,下拉数据是一个数组arrary,然后有两个单选按钮,选择的时候会过滤
data的数据,然后赋值给array,切换的时候报错

TypeError: Cannot read properties of undefined (reading 'key')

vue TypeError: Cannot read properties of undefined (reading ‘key‘)_第1张图片
解决办法,在nextTick中赋值

this.$nextTick(() => {
        this.array= data;
      });

你可能感兴趣的:(vue,vue.js,javascript,ecmascript)