From 718a7516af7e9c6f0584ec46f0ae4027a4a22ef9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=A6=BE=E5=87=A0=E6=B5=B7?= Date: Wed, 1 Jul 2020 00:05:00 +0800 Subject: [PATCH] =?UTF-8?q?=E7=BC=96=E5=86=99=E9=80=9A=E7=94=A8=E7=BB=84?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common-table/common-table.component.html | 8 +++++++- .../common-table/common-table.component.ts | 17 ++++++++++++----- 2 files changed, 19 insertions(+), 6 deletions(-) diff --git a/src/app/view/admin/components/common-table/common-table.component.html b/src/app/view/admin/components/common-table/common-table.component.html index 670afdf..22e3c51 100644 --- a/src/app/view/admin/components/common-table/common-table.component.html +++ b/src/app/view/admin/components/common-table/common-table.component.html @@ -1,4 +1,10 @@ - + diff --git a/src/app/view/admin/components/common-table/common-table.component.ts b/src/app/view/admin/components/common-table/common-table.component.ts index b17761a..f40273b 100644 --- a/src/app/view/admin/components/common-table/common-table.component.ts +++ b/src/app/view/admin/components/common-table/common-table.component.ts @@ -1,4 +1,4 @@ -import {Component, Input, OnInit} from '@angular/core'; +import {Component, Input, OnChanges, OnInit, SimpleChanges} from '@angular/core'; import {Data} from './data'; import {PageList, RequestObj} from '../../../../class/HttpReqAndResp'; import {HttpService} from '../../../../api/http/http.service'; @@ -8,7 +8,7 @@ import {HttpService} from '../../../../api/http/http.service'; templateUrl: './common-table.component.html', styleUrls: ['./common-table.component.less'] }) -export class CommonTableComponent implements OnInit { +export class CommonTableComponent implements OnInit, OnChanges { constructor(private httpService: HttpService) { @@ -20,9 +20,7 @@ export class CommonTableComponent implements OnInit { dataList: PageList = new PageList(); ngOnInit(): void { - this.httpService.Service>(this.request).subscribe(resp => { - this.dataList = resp.result; - }); + this.getData(); this.data.forEach(dat => { if (!dat.action) return; dat.action.forEach(act => { @@ -33,4 +31,13 @@ export class CommonTableComponent implements OnInit { }) } + getData = () => { + this.httpService.Service>(this.request).subscribe(resp => { + this.dataList = resp.result; + }); + } + + ngOnChanges(changes: SimpleChanges): void { + } + }