@@ -31,8 +31,8 @@ const state = reactive({
animationClass: '' //添加animate动画
})
-const wrapEl = ref
(null)
-const contentEl = ref(null)
+const wrapElRef = ref(null)
+const contentElRef = ref(null)
const contentStyle = computed(() => {
return {
@@ -48,8 +48,8 @@ watch(
() => props.content,
() => {
nextTick(() => {
- const wrapWidth = (wrapEl.value as HTMLDivElement)?.getBoundingClientRect()?.width
- const offsetWidth = (contentEl.value as HTMLDivElement)?.getBoundingClientRect()?.width
+ const wrapWidth = (wrapElRef.value as HTMLDivElement)?.getBoundingClientRect()?.width
+ const offsetWidth = (contentElRef.value as HTMLDivElement)?.getBoundingClientRect()?.width
state.wrapWidth = wrapWidth
state.offsetWidth = offsetWidth
state.duration = offsetWidth / props.speed
@@ -62,7 +62,7 @@ watch(
)