mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-23 05:58:26 +08:00
refactor(segment): remove uneccessary function
This commit is contained in:
@ -17,7 +17,7 @@ export class SegmentView implements ComponentInterface {
|
|||||||
if (!atSnappingPoint) return;
|
if (!atSnappingPoint) return;
|
||||||
|
|
||||||
const index = Math.round(scrollLeft / offsetWidth);
|
const index = Math.round(scrollLeft / offsetWidth);
|
||||||
const segmentContent = this.getSegmentContentAtIndex(index);
|
const segmentContent = this.getSegmentContents()[index];
|
||||||
|
|
||||||
if (segmentContent === null || segmentContent === undefined) {
|
if (segmentContent === null || segmentContent === undefined) {
|
||||||
return;
|
return;
|
||||||
@ -50,10 +50,6 @@ export class SegmentView implements ComponentInterface {
|
|||||||
return Array.from(this.el.querySelectorAll('ion-segment-content'));
|
return Array.from(this.el.querySelectorAll('ion-segment-content'));
|
||||||
}
|
}
|
||||||
|
|
||||||
private getSegmentContentAtIndex(index: number) {
|
|
||||||
return this.getSegmentContents()[index];
|
|
||||||
}
|
|
||||||
|
|
||||||
private getSegmentButtonById(id: string) {
|
private getSegmentButtonById(id: string) {
|
||||||
return document.querySelector(`ion-segment-button[content-id="${id}"]`);
|
return document.querySelector(`ion-segment-button[content-id="${id}"]`);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user