-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
滚动条监听滚动变化事件报错 #5656
Comments
具体报错内容是? |
VM59:38 Uncaught TypeError: Cannot read properties of null (reading 'addEventListener') document.querySelector('.slider').addEventListener('valuechange', (evt) => {
console.info(evt.detail);
});
// document.querySelector('.slider') 是null吧 |
应该是没有找到 slider,你 console.log(document) 一下,在控制台找一下这个组件 |
我这边用的是scrollbar不是slider,可能scrollbar的文档有点问题。从dom看,scrollbar好像是canvas画的,不是dom元素。这个要怎么拿到滚动值呢。 |
pearmini
pushed a commit
that referenced
this issue
Oct 31, 2023
Co-authored-by: ben.wen <[email protected]>
通过监听事件的方式拿到: slider.addEventListener('valuechange', onValueChange); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
文档中的DEMO: https://g2.antv.antgroup.com/spec/component/scrollbar
代码如下:
The text was updated successfully, but these errors were encountered: