/** * scroll API 文档 * props default 说明 * scrollDirection y 滚动方向, 默认 y 纵向滚动, x 表示横向滚动 * lowerThreshold 50 距离底部多少触发 * scrollTop 0 设置滚动条位置 * scrollLeft 0 设置滚动条位置 * showScrollbar false 是否展示滚动条 * * scroll 事件 * 事件名 回调参数 说明 * scroll - 滚动时触发 * scrollStart - 滚动开始时触发 * scrollEnd - 滚动结束时触发 * scrollToLower - 滚动到底部触发 * scrollToUpper - 滚动到顶部触发 ❌ 不支持 * * * 注意: * 使用前 slot 应包一层 view 防止位置颠倒 */ import { Component, ComponentProps, CustomEvent, Event } from 'waft'; import { JSONObject } from 'waft-json'; export class Scroll extends Component { constructor(props: ComponentProps) { super(props); } onScrollToLower(e: Event): void{ this.props.dispatch('onScrollToLower', new JSONObject()); } onScroll(e: Event): void{ this.props.dispatch('onScroll', new JSONObject()); } onScrollStart(e: Event): void{ this.props.dispatch('onScrollStart', new JSONObject()); } onScrollEnd(e: Event): void{ this.props.dispatch('onScrollEnd', new JSONObject()); } }