From aa2cc33ec9c1095013d509a519f6f4bbd5724cc1 Mon Sep 17 00:00:00 2001 From: spe_rains Date: Thu, 27 May 2021 18:15:01 +0800 Subject: [PATCH] =?UTF-8?q?bug=E4=BF=AE=E5=A4=8D?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 如果初始值是空数组, 通过动态获取数据后仍然不能触发滚动. 原因是因为data 从 props解构出来后不再是一个响应性变量. --- src/components/SeamlessScroll/src/SeamlessScroll.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/SeamlessScroll/src/SeamlessScroll.vue b/src/components/SeamlessScroll/src/SeamlessScroll.vue index a90b00632..b015ffd00 100644 --- a/src/components/SeamlessScroll/src/SeamlessScroll.vue +++ b/src/components/SeamlessScroll/src/SeamlessScroll.vue @@ -188,7 +188,8 @@ export default defineComponent({ }); let scrollSwitch = computed(() => { - return data.length >= unref(options).limitMoveNum; + // 从 props 解构出来的 属性 不再具有相应性. + return props.data.length >= unref(options).limitMoveNum; }); let hoverStopSwitch = computed(() => {