我在控件的初始化后,添加了如下代码:setTimeout(function(){$('div').find('.reportContent').addClass('repscroll');}, 1000);setTimeout(function() { //隐藏报表块report32_c的滚动条(此报表块名为report32_c,根据具体情况修改) $("div").find(".frozen-north").css({ 'overflow-x':'hidden' }); $("div").find(".frozen-center").css({ 'overflow-x':'hidden' });},1000);setTimeout(function() {var a = 'REPORT_GKQYZS'; //获取对应报表块名称var b = a.toUpperCase(); //防止大小写出现误差,此处自动将名称转成大写var wid = ($("div").width() - 17) + 'px'; //获取报表块宽度$("div").css('width', wid); //重置报表块宽度//var height = ($("div").height() - 16) + 'px'; //获取报表块高度//$("div").css('height', height); //重置报表块高度}, 100); window.flag1 = true;var self1 = this;//鼠标悬停,滚动停止setTimeout(function() { $("div").find(".frozen-center").mouseover(function() { window.flag1 = false; }); //鼠标离开,继续滚动 $("div").find(".frozen-center").mouseleave(function() { window.flag1 = true; }); var old = -1; var interval = setInterval(function() { if (!self1.isVisible()) { return; } if (window.flag1) { currentpos1 = $("div").find(".frozen-center").scrollTop; console.log("currentpos1 ="+$("div").find(".frozen-center") ); console.log("currentpos2 ="+currentpos1 ); if (currentpos1 == old && 0!=currentpos1) { $("div").find(".frozen-center").scrollTop = 0; } else { old = currentpos1; //以25ms的速度每次滚动1.5PX $("div").find(".frozen-center").scrollTop = currentpos1 + 1.5; } } }, 25);},5000);setTimeout(function() { //隐藏报表块report32_c的滚动条(此报表块名为report32_c,根据具体情况修改) $("div").find(".frozen-north").css({ 'overflow-x':'hidden', 'overflow-y':'hidden' }); $("div").find(".frozen-center").css({ 'overflow-x':'hidden', 'overflow-y':'hidden' }); },1000);运行时提示 Uncaught TypeError: Cannot read properties of undefined (reading 'scrollTop')定位到 问题出现的位置是$("div").find(".frozen-center") 这一行,这个是哪里设置的不对造成的呢