在列表頁使用vue傳值給詳情頁后,詳情頁中又增加了新的數(shù)據(jù)請求vue渲染,但是返回后打開另一個(gè)詳情頁vue數(shù)據(jù)還在,沒有重置,vm數(shù)據(jù)重置了,但是再次請求的item數(shù)據(jù)還在,依舊重復(fù)使用。//窗口隱藏時(shí),重置頁面數(shù)據(jù)mui.plusReady(function(){varself=plus.webview.currentWebview();self.addEventListener("hide",function(e){window.scrollTo(0,0);vm.resetData();},false);});這是頁面vm數(shù)據(jù)的重置代碼,怎么重置item數(shù)據(jù)呢?varnews=newVue({el:'#news',data:{items:[],//列表信息流數(shù)據(jù)},functionconvert(items){varnewItems=[];items.forEach(function(item){newItems.push({id:item.id,useride:item.useride,fukanid:item.fukanid,pingtime:item.pingime,avatars:'http://werd.imwork.net:90/public/'+item.avatars,time:getDateDiff(item.pingtime),usernames:item.usernames,pingcongtent:item.pingcongtent,});});returnnewItems;};這是新的vue請求數(shù)據(jù),請問怎么點(diǎn)擊返回后將item的數(shù)據(jù)也重置呢??
vue返回后重置頁面數(shù)據(jù)
森林海
2019-05-12 14:02:38