解决报错:キャッチされません (約束どおり) TypeError: _this.roomInformation.push は関数ではありません

 [アーカイブ] をクリックすると、プリント ステーションでこのエラーが発生しますが、ページには影響しません。

//接口中的代码直接处理,并赋值给页面需要用的字段——————原本方法,导致报错

response.data.roomList.forEach(item => {
            this.roomInformation.push(item.building + '-' + item.floor + '-' + item.room)
          })
          this.roomInformation = this.roomInformation.join(',')



//将获取的接口数据用data定义的数据接住,并新增一个数据存储处理的数据。最后再处理赋值给需要显示的页面使用————修改后的方法,页面没有报错

const roomList = []
          this.contractData.roomList.forEach(item => {
            roomList.push(item.building + '-' + item.floor + '-' + item.room)
          })
          this.roomInformation = roomList.join(',')

おすすめ

転載: blog.csdn.net/m0_65274248/article/details/128058591