mine.page.ts 646 B

12345678910111213141516171819202122232425
  1. import { Component, OnInit } from '@angular/core';
  2. // 由于Parse本身是js库,在ts中加载需要通过 * as Parse转换一下
  3. import * as Parse from "parse"
  4. @Component({
  5. selector: 'app-mine',
  6. templateUrl: './mine.page.html',
  7. styleUrls: ['./mine.page.scss'],
  8. })
  9. export class MinePage implements OnInit {
  10. // 由于Parse.User.current()是随着localStorage变化的属性
  11. // 为了避免首次复制后用户状态变化,页面不同步,通过get方法实现实时获取
  12. get user():Parse.User|undefined{
  13. return Parse.User.current()
  14. }
  15. constructor() {
  16. }
  17. ngOnInit() {
  18. }
  19. logout(){
  20. Parse.User.logOut();
  21. }
  22. }