LazyContainer.props.ts 1.16 KB
import type { PropType } from 'vue'

export const basicProps = {
  /**
     * Waiting time, if the time is specified, whether visible or not, it will be automatically loaded after the specified time
     */
  timeout: { type: Number },
  /**
     * The viewport where the component is located.
     * If the component is scrolling in the page container, the viewport is the container
     */
  viewport: {
    type: (typeof window !== 'undefined' ? window.HTMLElement : Object) as PropType<HTMLElement>,
    default: () => null,
  },
  /**
     * Preload threshold, css unit
     */
  threshold: { type: String, default: '0px' },
  /**
     * The scroll direction of the viewport, vertical represents the vertical direction, horizontal represents the horizontal direction
     */
  direction: {
    type: String,
    default: 'vertical',
    validator: (v: string) => ['vertical', 'horizontal'].includes(v),
  },
  /**
     * The label name of the outer container that wraps the component
     */
  tag: { type: String, default: 'div' },
  maxWaitingTime: { type: Number, default: 80 },
  /**
     * transition name
     */
  transitionName: { type: String, default: 'lazy-container' },
}