微信扫一扫看面试题

关注面试题库

vue子组件上传图片 watch监听回显 watch 没更新问题 已解决

请求回来的数据是res.data  将数据复制多一份为newdata

然后遍历将watch没显监听到的值设置为空

然后再将复制的数据赋值给你要显示 customerlist 即可

以下例子

get(){
    //请求回来的数据是res.data

   显示的列表数据为 this.customerlist
   this.customerlist=res.data
   var newdata=JSON.parse( JSON.stringify(res.data))
    
   res.data.records.map(res=>{
          res.invoiceUrl=''
   })
   setTimeout(()=>{ this.customerlist=newimg},2000)


}

 

posted @ 2022-07-23 10:02  web前端面试小助手  阅读(42)  评论(0)    收藏  举报