姜皓天 il y a 5 mois
Parent
commit
78b57b20fb
1 fichiers modifiés avec 37 ajouts et 3 suppressions
  1. 37 3
      src/app/articlethree/articlethree.component.ts

+ 37 - 3
src/app/articlethree/articlethree.component.ts

@@ -1,12 +1,46 @@
-import { Component } from '@angular/core';
-
+import { Component, OnInit } from '@angular/core';
+import * as Parse from "parse"
 
 @Component({
   selector: 'app-articlethree',
   templateUrl: './articlethree.component.html',
   styleUrls: ['./articlethree.component.scss']
 })
-export class ArticlethreeComponent {
+export class ArticlethreeComponent implements OnInit{
+  storiesData: any[] = []; // 给变量一个初始值
+  titlesData: any[] = []; // 给变量一个初始值
+  authorsData: any[] = []; // 给变量一个初始值
+  datesData: any[] = []; // 给变量一个初始值
+  constructor() { }
+
+  ngOnInit(): void {
+    const Jht430 = Parse.Object.extend('Jht430');
+    const query = new Parse.Query(Jht430);
+
+    query.get('jWdWQlpHsC').then((result) => {
+      this.storiesData = result.get('stories');
+    }).catch((error) => {
+      console.error('Error retrieving stories data: ', error);
+    });
+
+    query.get('jWdWQlpHsC').then((result) => {
+      this.titlesData = result.get('titles');
+    }).catch((error) => {
+      console.error('Error retrieving titles data: ', error);
+    });
+
+    query.get('jWdWQlpHsC').then((result) => {
+      this.authorsData = result.get('authors');
+    }).catch((error) => {
+      console.error('Error retrieving authors data: ', error);
+    });
+ 
+    query.get('jWdWQlpHsC').then((result) => {
+      this.datesData = result.get('dates');
+    }).catch((error) => {
+      console.error('Error retrieving dates data: ', error);
+    });
+  }
 
 
   comments = [