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 { + } + }