12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- 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 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 = [
- { user: '阿平', avatar: '../../assets/images/passerby1.jpg', message: '哇塞' },
- { user: '明天在不在', avatar: '../../assets/images/passerby2.jpg', message: '啊啊啊啊啊啊啊啊啊啊啊' },
- { user: '无敌暴龙', avatar: '../../assets/images/passerby3.jpg', message: '在哪里?' }
- ];
- newComment: string = '';
- addComment() {
- if (this.newComment) {
- const newComment = {
- user: '我',
- avatar: '../../assets/images/slide1.jpg',
- message: this.newComment
- };
- this.comments.push(newComment);
- this.newComment = '';
- }
- }
- }
|