Commit 21679eac authored by 神楽坂玲奈's avatar 神楽坂玲奈

arena

parent 5c3dd98d
nz-table::ng-deep .ant-table {
background: white;
}
<nz-table #ajaxTable [nzData]="listOfData" [nzLoading]="loading" nzSize="small" [nzShowPagination]="false">
<thead>
<tr>
<th>Rank</th>
<th>Deck</th>
<th>Count</th>
</tr>
</thead>
<tbody>
<tr *ngFor="let data of ajaxTable.data; let i = index">
<td>{{ i+1 }}</td>
<td>{{ data.name }}</td>
<td>{{ data.count }}</td>
</tr>
</tbody>
</nz-table>
import { fakeAsync, ComponentFixture, TestBed } from '@angular/core/testing';
import { ArenaTableComponent } from './arena-table.component';
describe('ArenaTableComponent', () => {
let component: ArenaTableComponent;
let fixture: ComponentFixture<ArenaTableComponent>;
beforeEach(fakeAsync(() => {
TestBed.configureTestingModule({
declarations: [ ArenaTableComponent ]
})
.compileComponents();
fixture = TestBed.createComponent(ArenaTableComponent);
component = fixture.componentInstance;
fixture.detectChanges();
}));
it('should compile', () => {
expect(component).toBeTruthy();
});
});
import { HttpClient } from '@angular/common/http';
import { Component, OnInit } from '@angular/core';
@Component({
selector: 'app-arena-table',
templateUrl: './arena-table.component.html',
styleUrls: ['./arena-table.component.css']
})
export class ArenaTableComponent implements OnInit {
listOfData: ArenaDeck[] = [];
loading = true;
constructor(private http: HttpClient) {}
async ngOnInit() {
this.listOfData = await this.http
.get<ArenaDeck[]>('https://api.mycard.moe/ygopro/analytics/deck/type', {
params: {
type: 'day',
source: 'mycard-athletic'
}
})
.toPromise();
this.loading = false;
}
}
interface ArenaDeck {
count: '661';
name: '转生炎兽';
recent_time: '2019-07-15T00:00:00.000Z';
source: 'mycard-athletic';
tags: ['转生炎兽-陀螺', '转生炎兽-割草'];
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment