You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
38 lines
703 B
38 lines
703 B
import {Component, EventEmitter, Input, OnInit, Output} from '@angular/core';
|
|
import {Page} from '../interface/Page';
|
|
|
|
@Component({
|
|
selector: 'app-page',
|
|
templateUrl: './page.component.html',
|
|
styleUrls: ['./page.component.scss']
|
|
})
|
|
export class PageComponent implements OnInit {
|
|
|
|
// 数据源
|
|
@Input()
|
|
pageData: Page<any>;
|
|
|
|
// 触发翻页事件
|
|
@Output()
|
|
voted = new EventEmitter<number>();
|
|
|
|
// 记录数
|
|
@Input()
|
|
currentPage: number;
|
|
|
|
constructor() {
|
|
}
|
|
|
|
ngOnInit(): void {
|
|
}
|
|
|
|
loadAll(page: number) {
|
|
this.voted.emit(page);
|
|
}
|
|
|
|
changePage() {
|
|
if (this.currentPage > this.pageData.totalPage) {
|
|
this.currentPage = this.pageData.currentPage;
|
|
}
|
|
}
|
|
}
|
|
|