记录
<script setup lang="ts">
import {
computed, reactive, ref } from 'vue'
import {
useAnimationFrame } from '../utils'
const props = withDefaults(
defineProps<{
/** 每秒多少像素 */
speed?: number
/** 浮动时停止滚动 */
hoverStop?: boolean
/** 方向 */
dir?: 'x' | 'y'
}>(),
{
speed: 50,
hoverStop: false,
dir: 'y',
}
)
const boxEl = ref<HTMLDivElement>()
const boxSize = reactive({
w: 0, h: 0 })
useAnimationFrame(() => {
if (!boxEl.value) return
boxSize.w =