import { defineComponent, watch } from '@vue/composition-api'; import './index.scss'; import { fixStyle, flexWidth } from '../../utils/dom'; import { BOTTOM_SCROLL_HEIGHT, SCROLL_WIDTH } from '@/lib/constants/dom-fixed'; import {log} from "@/lib/utils/log"; export const BottomScroll = defineComponent({ name: 'BottomScroll', emits: ['scroll'], props: { leftWidth: { required: true, type: Number, }, scrollLeft: { required: true, type: Number, }, scrollWidth: { required: true, type: Number, }, rightWidth: { required: true, type: Number, }, }, setup(props, ctx) { watch( () => props.scrollLeft, (left: number) => { (ctx.refs['scroll'] as Element).scrollLeft = left; }, ); return { onScroll: (e: PointerEvent) => ctx.emit('scroll', e), }; }, render() { log(`[render] bottom-scroll render`); const { leftWidth, scrollWidth, rightWidth, onScroll } = this; const widthHeight = (width: number) => ({ height: BOTTOM_SCROLL_HEIGHT, ...flexWidth(width), }); return (