我目前遇到离子日历的问题,因为我能够将输入事件保存在数组中,检索数组并在控制台上显示信息。但是,我无法利用该数组并在其原始列表中显示该数组。我是离子的小伙子:-)所以任何帮助都会有很长的路要走。
到目前为止,这是我的代码:
//where data is received from a modal and received as(data)
modal.onDidDismiss(data =>{
if (data){
let eventData=data;
eventData.startTime= new Date(data.startTime);
eventData.endTime= new Date(data.endTime);
//initialization of array
//这是显示数组的地方
let events=this.eventSource;
events.push(eventData);
this.eventSource=[];
setTimeout(() =>{
this.eventSource=events;
});
//saving the array of events
this.storage.set('data1',JSON.stringify(events));
}
});
}
//once view is loaded the saved array should display as before the page is closed.
ionViewWillEnter() {
console.log("Showing the first page!");
this.storage.get('data1').then((data1)=>{
if(data1){
console.log(JSON.parse(data1));
return JSON.parse(data1);
}
});