反应
class Reaction {
_page = 1;
get page() {
return this._page;
}
set page(newValue) {
this._page = newValue;
this.getNextPageData();
}
getNextPageData() {
// ...
console.log("curent page is: ", this.page);
console.log("get next page data");
}
}
const reaction = new Reaction();
reaction.page += 1;
行动
class Action {
_page = 1;
get page() {
return this._page;
}
set page(newValue) {
this._page = newValue;
}
getNextPageData() {
// ...
console.log("curent page is: ", this.page);
console.log("get next page data");
}
}
const action = new Action();
action.page += 1;
action.getNextPageData();