tab3.page.ts 910 B

123456789101112131415161718192021222324252627282930313233
  1. import { Component } from '@angular/core';
  2. // 由于Parse本身是js库,在ts中加载需要通过 * as Parse转换一下
  3. import Parse from "parse"
  4. @Component({
  5. selector: 'app-tab3',
  6. templateUrl: 'tab3.page.html',
  7. styleUrls: ['tab3.page.scss']
  8. })
  9. export class Tab3Page {
  10. // 由于Parse.User.current()是随着localStorage变化的属性
  11. // 为了避免首次复制后用户状态变化,页面不同步,通过get方法实现实时获取
  12. user:Parse.User|undefined
  13. async ngOnInit() {
  14. this.user = await Parse.User.current()
  15. setInterval(async ()=>{
  16. this.user = await Parse.User.current()
  17. },1000)
  18. }
  19. logout(){
  20. Parse.User.logOut();
  21. }
  22. constructor() {}
  23. myItems:Array<any> = [
  24. {title:"看书面广告"},
  25. {title:"听书免广告"},
  26. {title:"万本会员书"},
  27. {title:"阅读背景"},
  28. {title:"故事免费读"},
  29. {title:"离线下载"},]
  30. }