after the list page uses vue to pass values to the details page, new data is added to the details page to request vue rendering. However, after the return, another detail page is opened. The vue data is still there and has not been reset. The vm data is reset, but the item data requested again is still there and is still used repeatedly.
//
mui.plusReady(function () {
var self = plus.webview.currentWebview();
self.addEventListener("hide",function (e) {
window.scrollTo(0, 0);
vm.resetData();
},false);
});
this is the reset code for the vm data of the page. How to reset the item data?
var news = new Vue({
el: "-sharpnews",
data: {
items: [], //
},
function convert(items) {
var newItems = [];
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,
});
});
return newItems;
};
this is the new vue request data. How can I reset the item data after clicking back?