Commit 2a806304 authored by nanahira's avatar nanahira

add pageLimit

parent b563fcb7
......@@ -20,6 +20,9 @@ export class InstanceConfig implements PicSourceInfo {
})
endpoint: string;
@DefineSchema({ description: '页数上限。', default: 200 })
pageLimit: number;
// 给目标对象注入上述对象。
applyTo(target: PicSourceInfo) {
target.tags = this.tags;
......@@ -38,4 +41,5 @@ export class PicSourceYandePluginConfig {
instances: InstanceConfig[];
}
export type PicSourceYandePluginConfigLike = Partial<PicSourceYandePluginConfig>;
export type PicSourceYandePluginConfigLike =
Partial<PicSourceYandePluginConfig>;
......@@ -20,7 +20,7 @@ export class PicSourceInstance extends PicSource {
private page = 1;
private nextPage() {
const currentPage = this.page;
if (this.page >= 200) {
if (this.page >= this.config.pageLimit) {
this.page = 1;
} else {
++this.page;
......
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