import { Component } from '@angular/core'; // 由于Parse本身是js库,在ts中加载需要通过 * as Parse转换一下 import Parse from "parse" @Component({ selector: 'app-tab3', templateUrl: 'tab3.page.html', styleUrls: ['tab3.page.scss'] }) export class Tab3Page { // 由于Parse.User.current()是随着localStorage变化的属性 // 为了避免首次复制后用户状态变化,页面不同步,通过get方法实现实时获取 user:Parse.User|undefined async ngOnInit() { this.user = await Parse.User.current() setInterval(async ()=>{ this.user = await Parse.User.current() },1000) } logout(){ Parse.User.logOut(); } constructor() {} myItems:Array = [ {title:"看书面广告"}, {title:"听书免广告"}, {title:"万本会员书"}, {title:"阅读背景"}, {title:"故事免费读"}, {title:"离线下载"},] }