angular - ngx-fullpage - 如何访问 OnLeave 中的角度变量?
问题描述
我有这个...
<div mnFullpage [mnFullpageOnLeave]="onLeave">
<div class="section welcome-section fp-section fp-table" *ngFor="let p of this.content.pages">
<div class="fp-tableCell">
<div class="page">
<div class="contentLayer">
Content goes here
</div>
</div>
</div>
import { Component } from '@angular/core';
import { MnFullpageService } from 'ngx-fullpage';
@Component({
selector: 'app-main-page',
templateUrl: './mainPage.component.html',
styleUrls: ['./mainPage.component.scss']
})
export class MainPageComponent {
readonly content = Content
pageIndex: number = 0;
constructor(public fullpageService: MnFullpageService) {
}
onLeave(index: number, nextIndex: object, direction: string): void {
this.pageIndex = nextIndex.index;
}
}
问题是……当我在 onLeave 中设置变量 pageIndex 时……这没有反映出来。有什么建议吗?
解决方案
推荐阅读
- ios - 为什么 URL 不能快速打开?
- python - 如何从文件名中提取艺术家姓名和歌曲名称?
- javascript - 使用 React.forwardRef 与自定义 ref 道具的价值
- javascript - 如何根据共同的属性将数组中的对象分组为数组数组
- reactjs - React JS:根据收到的状态渲染孩子
- qt - Qt 继承自 QWidget 类来自定义和使用它
- module - 在项目的库根目录中声明的模块中使用 Rust 特征
- arduino - 如何在 UnoArduSim 中使用七段
- swift - 在 Swift 中求和两个泛型值的最佳方法
- javascript - Firebase 功能:使用保留的托管 url 时设置区域