{"id":43122959,"url":"https://github.com/iwe7/iwe7-ng-better-scroll","last_synced_at":"2026-01-31T20:03:45.484Z","repository":{"id":57278801,"uuid":"128533667","full_name":"iwe7/iwe7-ng-better-scroll","owner":"iwe7","description":"better-scroll for angular","archived":false,"fork":false,"pushed_at":"2018-04-08T05:37:36.000Z","size":22,"stargazers_count":7,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-27T03:57:47.500Z","etag":null,"topics":["angular","better-scroll","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iwe7.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-04-07T14:00:59.000Z","updated_at":"2019-04-26T08:38:24.000Z","dependencies_parsed_at":"2022-09-18T09:12:46.527Z","dependency_job_id":null,"html_url":"https://github.com/iwe7/iwe7-ng-better-scroll","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/iwe7/iwe7-ng-better-scroll","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwe7%2Fiwe7-ng-better-scroll","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwe7%2Fiwe7-ng-better-scroll/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwe7%2Fiwe7-ng-better-scroll/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwe7%2Fiwe7-ng-better-scroll/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iwe7","download_url":"https://codeload.github.com/iwe7/iwe7-ng-better-scroll/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iwe7%2Fiwe7-ng-better-scroll/sbom","scorecard":{"id":498839,"data":{"date":"2025-08-11","repo":{"name":"github.com/iwe7/iwe7-ng-better-scroll","commit":"d9825cd96b53c54467266a0f610789de5b318592"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":2.6,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/8 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":0,"reason":"license file not detected","details":["Warn: project does not have a license file"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Vulnerabilities","score":10,"reason":"0 existing vulnerabilities detected","details":null,"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}}]},"last_synced_at":"2025-08-19T21:16:52.258Z","repository_id":57278801,"created_at":"2025-08-19T21:16:52.258Z","updated_at":"2025-08-19T21:16:52.258Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28952582,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-31T18:30:42.805Z","status":"ssl_error","status_checked_at":"2026-01-31T18:30:19.593Z","response_time":128,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["angular","better-scroll","typescript"],"created_at":"2026-01-31T20:03:34.960Z","updated_at":"2026-01-31T20:03:45.474Z","avatar_url":"https://github.com/iwe7.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"### [better-scroll](https://github.com/ustbhuangyi/better-scroll) 是什么\n\n\u003e better-scroll 是一款重点解决移动端（已支持 PC）各种滚动场景需求的插件。它的核心是借鉴的 iscroll 的实现，它的 API 设计基本兼容 iscroll，在 iscroll 的基础上又扩展了一些 feature 以及做了一些性能优化。\n\u003e better-scroll 是基于原生 JS 实现的，不依赖任何框架。它编译后的代码大小是 63kb，压缩后是 35kb，gzip 后仅有 9kb，是一款非常轻量的 JS lib。\n\n### [github 源码](https://github.com/iwe7/iwe7-ng-better-scroll)\n\n### 安装\n\n```sh\nyarn add iwe7-ng-better-scroll\n```\n\n### api\n\n* 请参考[better-scroll api](https://ustbhuangyi.github.io/better-scroll/doc/zh-hans/)\n\n### 使用\n\n```ts\nimport {\n  NgBetterScrollModule,\n  BetterScrollConfigDefault\n} from \"iwe7-ng-better-scroll\";\n\n@NgModule({\n  imports: [\n    ...\n    NgBetterScrollModule.forRoot(BetterScrollConfigDefault)\n    ...\n  ]\n})\nexport class AppModule {}\n```\n\n### 在模板中使用\n\n```\n\u003cbetter-scroll (onPullingDown)=\"init($event)\"\n  (onPullingUp)=\"loadMore($event)\"\u003e\n  \u003cul\u003e\n    \u003cli *ngFor=\"let item of list\"\u003e\n      {{item}}\n    \u003c/li\u003e\n  \u003c/ul\u003e\n\u003c/better-scroll\u003e\n```\n\n```ts\nimport {\n  Component,\n  OnInit,\n  ElementRef,\n  InjectionToken,\n  Inject,\n  AfterViewInit,\n  ViewChild,\n  Input,\n  OnChanges,\n  SimpleChanges,\n  EventEmitter,\n  Output,\n  OnDestroy\n} from \"@angular/core\";\n// import BScroll from \"better-scroll\";\n// 为了兼容才这样写\nimport * as _better_scroll from \"better-scroll\";\nconst BScroll = (_better_scroll as any).default || _better_scroll;\n\nexport const BETTER_SCROLL_CONFIG = new InjectionToken(\"BETTER_SCROLL_CONFIG\");\nimport { CdkObserveContent } from \"@angular/cdk/observers\";\n\nexport const BetterScrollConfigDefault = {\n  startX: 0,\n  startY: 0,\n  scrollX: false,\n  scrollY: true,\n  freeScroll: false,\n  directionLockThreshold: 5,\n  eventPassthrough: \"\",\n  click: false,\n  tap: false,\n  bounce: true,\n  bounceTime: 800,\n  momentum: true,\n  momentumLimitTime: 300,\n  momentumLimitDistance: 15,\n  swipeTime: 2500,\n  swipeBounceTime: 500,\n  deceleration: 0.001,\n  flickLimitTime: 200,\n  flickLimitDistance: 100,\n  resizePolling: 60,\n  probeType: 0,\n  preventDefault: true,\n  preventDefaultException: {\n    tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/\n  },\n  HWCompositing: true,\n  useTransition: true,\n  useTransform: true,\n  bindToWrapper: false,\n  observeDOM: true,\n  autoBlur: true,\n  wheel: false,\n  snap: false,\n  scrollbar: false,\n  pullDownRefresh: {\n    threshold: 50,\n    stop: 20\n  },\n  pullUpLoad: { threshold: 50 },\n  mouseWheel: {\n    speed: 20,\n    invert: false\n  },\n  stopPropagation: false\n};\n\nexport interface BetterScrollWhellInterface {\n  selectedIndex: number;\n  rotate: number;\n  adjustTime: number;\n  wheelWrapperClass: string;\n  wheelItemClass: string;\n}\n\nexport interface BetterScrollEasingInterface {\n  style: string;\n  fn: Function;\n}\n\nexport interface BetterScrollSnapInterface {\n  loop: boolean;\n  threshold: number;\n  stepX: number;\n  stepY: number;\n  easing: BetterScrollEasingInterface;\n}\n\nexport interface BetterScrollScrollbarInterface {\n  fade: boolean;\n  interactive: boolean;\n}\n\nexport interface BetterScrollPullDownRefreshInterface {\n  threshold: number;\n  stop: number;\n}\n\nexport interface BetterScrollPullUpLoadInterface {\n  threshold: number;\n}\n\nexport interface BetterScrollMouseWheelInterface {\n  speed: number;\n  invert: boolean;\n}\n\n@Component({\n  selector: \"better-scroll\",\n  templateUrl: \"./better-scroll.component.html\",\n  styleUrls: [\"./better-scroll.component.scss\"]\n})\nexport class BetterScrollComponent implements OnInit, OnChanges, OnDestroy {\n  scroll: any;\n  // 配置选项\n  // 横轴方向初始化位置。\n  @Input() startX: number = 0;\n  // 纵轴方向初始化位置\n  @Input() startY: number = 0;\n  // 当设置为 true 的时候，可以开启横向滚动\n  @Input() scrollX: boolean = false;\n  // 当设置为 true 的时候，可以开启纵向滚动\n  @Input() scrollY: boolean = true;\n  // 有些场景我们需要支持横向和纵向同时滚动，而不仅限制在某个方向，这个时候我们只要设置 freeScroll 为 true 即可\n  @Input() freeScroll: boolean = false;\n  // 当我们需要锁定只滚动一个方向的时候，我们在初始滚动的时候根据横轴和纵轴滚动的绝对值做差，当差值大于 directionLockThreshold 的时候来决定滚动锁定的方向。\n  @Input() directionLockThreshold: number = 5;\n  // 有时候我们使用 better-scroll 在某个方向模拟滚动的时候，希望在另一个方向保留原生的滚动（比如轮播图，我们希望横向模拟横向滚动，而纵向的滚动还是保留原生滚动，我们可以设置 eventPassthrough 为 vertical；相应的，如果我们希望保留横向的原生滚动，可以设置eventPassthrough为 horizontal）\n  @Input() eventPassthrough: string = \"\";\n  // better-scroll 默认会阻止浏览器的原生 click 事件。当设置为 true，better-scroll 会派发一个 click 事件，我们会给派发的 event 参数加一个私有属性 _constructed，值为 true。\n  @Input() click: boolean = false;\n  // 因为 better-scroll 会阻止原生的 click 事件，我们可以设置 tap 为 true，它会在区域被点击的时候派发一个 tap 事件，你可以像监听原生事件那样去监听它，如 element.addEventListener('tap', doSomething, false);。如果 tap 设置为字符串, 那么这个字符串就作为自定义事件名称。如 tap: 'myCustomTapEvent'。\n  @Input() tap: boolean = false;\n  // 当滚动超过边缘的时候会有一小段回弹动画。设置为 true 则开启动画。\n  @Input() bounce: boolean = true;\n  // 设置回弹动画的动画时长。\n  @Input() bounceTime: number = 800;\n  // 当快速在屏幕上滑动一段距离的时候，会根据滑动的距离和时间计算出动量，并生成滚动动画。设置为 true 则开启动画。\n  @Input() momentum: boolean = true;\n  // 只有在屏幕上快速滑动的时间小于 momentumLimitTime，才能开启 momentum 动画\n  @Input() momentumLimitTime: number = 300;\n  // 只有在屏幕上快速滑动的距离大于 momentumLimitDistance，才能开启 momentum 动画。\n  @Input() momentumLimitDistance: number = 15;\n  // 设置 momentum 动画的动画时长。\n  @Input() swipeTime: number = 2500;\n  // 设置当运行 momentum 动画时，超过边缘后的回弹整个动画时间\n  @Input() swipeBounceTime: number = 500;\n  // 表示 momentum 动画的减速度。\n  @Input() deceleration: number = 0.001;\n  // 有的时候我们要捕获用户的轻拂动作（短时间滑动一个较短的距离）。只有用户在屏幕上滑动的时间小于 flickLimitTime ，才算一次轻拂。\n  @Input() flickLimitTime: number = 200;\n  // 只有用户在屏幕上滑动的距离小于 flickLimitDistance ，才算一次轻拂。\n  @Input() flickLimitDistance: number = 100;\n  // 当窗口的尺寸改变的时候，需要对 better-scroll 做重新计算，为了优化性能，我们对重新计算做了延时。60ms 是一个比较合理的值。\n  @Input() resizePolling: number = 60;\n  // 有时候我们需要知道滚动的位置。当 probeType 为 1 的时候，会非实时（屏幕滑动超过一定时间后）派发scroll 事件；当 probeType 为 2 的时候，会在屏幕滑动的过程中实时的派发 scroll 事件；当 probeType 为 3 的时候，不仅在屏幕滑动的过程中，而且在 momentum 滚动动画运行过程中实时派发 scroll 事件。如果没有设置该值，其默认值为 0，即不派发 scroll 事件。\n  @Input() probeType: number = 0;\n  // 当事件派发后是否阻止浏览器默认行为。这个值应该设为 true，除非你真的知道你在做什么，通常你可能用到的是 preventDefaultException。\n  @Input() preventDefault: boolean = true;\n  // better-scroll 的实现会阻止原生的滚动，这样也同时阻止了一些原生组件的默认行为。这个时候我们不能对这些元素做 preventDefault，所以我们可以配置 preventDefaultException。默认值 {tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/}表示标签名为 input、textarea、button、select 这些元素的默认行为都不会被阻止。\n  @Input()\n  preventDefaultException: any = {\n    tagName: /^(INPUT|TEXTAREA|BUTTON|SELECT)$/\n  };\n  // 是否开启硬件加速，开启它会在 scroller 上添加 translateZ(0) 来开启硬件加速从而提升动画性能，有很好的滚动效果。\n  @Input() HWCompositing: boolean = true;\n  // 是否使用 CSS3 transition 动画。如果设置为 false，则使用 requestAnimationFrame 做动画。\n  @Input() useTransition: boolean = true;\n  // 是否使用 CSS3 transform 做位移。如果设置为 false, 则设置元素的 top/left (这种情况需要 scroller 是绝对定位的)。\n  @Input() useTransform: boolean = true;\n  // move 事件通常会绑定到 document 上而不是滚动的容器上，当移动的过程中光标或手指离开滚动的容器滚动仍然会继续，这通常是期望的。当然你也可以把 move 事件绑定到滚动的容器上，bindToWrapper 设置为 true 即可，这样一旦移动的过程中光标或手指离开滚动的容器，滚动会立刻停止。\n  @Input() bindToWrapper: boolean = false;\n  // 当在移动端环境（支持 touch 事件），disableMouse 会计算为 true，这样就不会监听鼠标相关的事件，而在 PC 环境，disableMouse 会计算为 false，就会监听鼠标相关事件，不建议修改该属性，除非你知道你在做什么。\n  @Input() disableMouse: boolean;\n  // 当在移动端环境（支持 touch 事件），disableTouch 会计算为 false，这样会监听 touch 相关的事件，而在 PC 环境，disableTouch 会计算为 true，就不会监听 touch 相关事件。不建议修改该属性，除非你知道你在做什么。\n  @Input() disableTouch: boolean;\n  // 会检测 scroller 内部 DOM 变化，自动调用 refresh 方法重新计算来保证滚动的正确性。它会额外增加一些性能开销，如果你能明确地知道 scroller 内部 DOM 的变化时机并手动调用 refresh 重新计算，你可以把该选项设置为 false。\n  @Input() observeDOM: boolean = false;\n  // 在滚动之前会让当前激活的元素（input、textarea）自动失去焦点\n  @Input() autoBlur: boolean = true;\n  // 是否阻止事件冒泡。\n  @Input() stopPropagation: boolean = false;\n\n  // ----高级 ----- //\n  @Input() wheel: BetterScrollWhellInterface | boolean = false;\n  @Input() snap: BetterScrollSnapInterface | boolean = false;\n  @Input() scrollbar: BetterScrollScrollbarInterface | boolean = false;\n  @Input()\n  pullDownRefresh: BetterScrollPullDownRefreshInterface | boolean = {\n    threshold: 50,\n    stop: 20\n  };\n  @Input()\n  pullUpLoad: BetterScrollPullUpLoadInterface | boolean = { threshold: 50 };\n  @Input()\n  mouseWheel: BetterScrollMouseWheelInterface | boolean = {\n    speed: 20,\n    invert: false\n  };\n\n  // outputs\n  @Output() onBeforeScrollStart: EventEmitter\u003cthis\u003e = new EventEmitter();\n  @Output() onScroll: EventEmitter\u003cBScroll.Position\u003e = new EventEmitter();\n\n  // 组件内部\n  // 是否已经创建了\n  isCreated: boolean = false;\n\n  @Output() onScrollCancel: EventEmitter\u003cany\u003e = new EventEmitter();\n  @Output() onScrollEnd: EventEmitter\u003cBScroll.Position\u003e = new EventEmitter();\n  @Output() onTouchEnd: EventEmitter\u003cBScroll.Position\u003e = new EventEmitter();\n  @Output() onFlick: EventEmitter\u003cany\u003e = new EventEmitter();\n  @Output() onRefresh: EventEmitter\u003cany\u003e = new EventEmitter();\n  @Output() onDestroy: EventEmitter\u003cany\u003e = new EventEmitter();\n\n  @Output() onPullingDown: EventEmitter\u003cthis\u003e = new EventEmitter();\n  @Output() onPullingUp: EventEmitter\u003cthis\u003e = new EventEmitter();\n\n  constructor(\n    // 通过注入的ElementRef访问dom\n    public ele: ElementRef,\n    // 通过注入 配置我们的默认参数\n    @Inject(BETTER_SCROLL_CONFIG) public _default: any\n  ) {}\n  /**\n   * 如果配置改变并且已经创建了 那么销毁重新创建\n   */\n  ngOnChanges(changes: SimpleChanges) {\n    let hasChanged: boolean = false;\n    for (let key in changes) {\n      this._default[key] = changes[key].currentValue;\n      hasChanged = true;\n    }\n    if (hasChanged \u0026\u0026 this.isCreated) {\n      this.destroy();\n      this.createScroll();\n    }\n  }\n  /**\n   * 注销移除\n   */\n  ngOnDestroy() {\n    this.destroy();\n  }\n\n  ngOnInit() {}\n\n  ngAfterViewInit() {\n    this.createScroll();\n  }\n\n  /**\n   * 监控dom内容变更\n   * 刷新better scroll\n   */\n  changeContent(e: any) {\n    this.refresh();\n  }\n  /**\n   * 初始化better scroll\n   */\n  createScroll() {\n    this.scroll = new BScroll(this.ele.nativeElement, this._default);\n    // 已经创建了\n    this.isCreated = true;\n    this.scroll.on(\"beforeScrollStart\", () =\u003e {\n      this.onBeforeScrollStart.emit(this);\n    });\n    this.scroll.on(\"scroll\", (pos: BScroll.Position) =\u003e {\n      this.onScroll.emit(pos);\n    });\n    this.scroll.on(\"scrollCancel\", () =\u003e {\n      this.onScrollCancel.emit();\n    });\n    this.scroll.on(\"scrollEnd\", (pos: BScroll.Position) =\u003e {\n      this.onScrollEnd.emit(pos);\n    });\n    this.scroll.on(\"touchEnd\", (pos: BScroll.Position) =\u003e {\n      this.onTouchEnd.emit(pos);\n    });\n    this.scroll.on(\"flick\", () =\u003e {\n      this.onFlick.emit();\n    });\n    this.scroll.on(\"refresh\", () =\u003e {\n      this.onRefresh.emit();\n    });\n    this.scroll.on(\"destroy\", () =\u003e {\n      this.onDestroy.emit();\n    });\n    this.scroll.on(\"pullingDown\", () =\u003e {\n      this.onPullingDown.emit(this);\n    });\n    this.scroll.on(\"pullingUp\", () =\u003e {\n      this.onPullingUp.emit(this);\n    });\n  }\n\n  // 刷新状态\n  refresh(): this {\n    this.scroll.refresh();\n    return this;\n  }\n  // 启用 better-scroll, 默认 开启\n  enable(): this {\n    this.scroll.enable();\n    return this;\n  }\n  // 禁用 better-scroll，DOM 事件（如 touchstart、touchmove、touchend）的回调函数不再响应\n  disable(): this {\n    this.scroll.disable();\n    return this;\n  }\n  // 相对于当前位置偏移滚动 x,y 的距离\n  scrollBy(x: number, y: number, time?: number, easing?: object): this {\n    this.scroll.scrollBy(x, y, time, easing);\n    return this;\n  }\n  // 滚动到指定的位置\n  scrollTo(x: number, y: number, time?: number, easing?: object): this {\n    this.scroll.scrollTo(x, y, time, easing);\n    return this;\n  }\n  // 滚动到指定的目标元素\n  scrollToElement(\n    el: HTMLElement | string,\n    time?: number,\n    offsetX?: number | boolean,\n    offsetY?: number | boolean,\n    easing?: object\n  ): this {\n    this.scroll.scrollToElement(el, time, offsetX, offsetY, easing);\n    return this;\n  }\n  // 立即停止当前运行的滚动动画\n  stop(): this {\n    this.scroll.stop();\n    return this;\n  }\n  // 销毁 better-scroll，解绑事件\n  destroy(): this {\n    this.scroll.destroy();\n    return this;\n  }\n\n  // 当我们做 slide 组件的时候，slide 通常会分成多个页面。调用此方法可以滚动到指定的页面。\n  goToPage(x: number, y: number, time?: number, easing?: object): this {\n    this.scroll.goToPage(x, y, time, easing);\n    return this;\n  }\n  // 滚动到下一个页面\n  next(time?: number, easing?: object): this {\n    this.next(time, easing);\n    return this;\n  }\n  // 滚动到上一个页面\n  prev(time?: number, easing?: object): this {\n    this.scroll.prev(time, easing);\n    return this;\n  }\n  // 获取当前页面的信息\n  getCurrentPage(): {\n    x: number;\n    y: number;\n    pageX: number;\n    pageY: number;\n  } {\n    return this.scroll.getCurrentPage();\n  }\n  // 当我们做 picker 组件的时候，调用该方法可以滚动到索引对应的位置\n  wheelTo(index: number): this {\n    this.scroll.wheelTo(index);\n    return this;\n  }\n  // 获取当前选中的索引值\n  getSelectedIndex(): number {\n    return this.scroll.getSelectedIndex();\n  }\n  // 当下拉刷新数据加载完毕后，需要调用此方法告诉 better-scroll 数据已加载\n  finishPullDown(): this {\n    this.scroll.finishPullDown();\n    return this;\n  }\n  // 当上拉加载数据加载完毕后，需要调用此方法告诉 better-scroll 数据已加载\n  finishPullUp(): this {\n    this.scroll.finishPullUp();\n    return this;\n  }\n  trigger(type: string): this {\n    this.scroll.trigger();\n    return this;\n  }\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwe7%2Fiwe7-ng-better-scroll","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fiwe7%2Fiwe7-ng-better-scroll","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fiwe7%2Fiwe7-ng-better-scroll/lists"}