12345678910111213141516171819202122232425262728 |
- import { Component, OnInit } from '@angular/core';
- // 由于Parse本身是js库,在ts中加载需要通过 * as Parse转换一下
- import * as Parse from "parse"
- @Component({
- selector: 'app-mine',
- templateUrl: './mine.page.html',
- styleUrls: ['./mine.page.scss'],
- })
- export class MinePage implements OnInit {
- constructor() {
-
- }
- // 由于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();
- }
- }
|