我试图在鼠标滚轮上触发水平滚动。但是,我认为打字稿不允许更新deltaX的值。不知道是否有人对此情况有想法。这是我的代码:
`document.querySelector('#tab-primary-wrapper .inner-wrapper').addEventListener('mousewheel', function(e: WheelEvent) {
this.deltaX -= (e.deltaY);
e.preventDefault();
},
`
答案 0 :(得分:0)
Do you try setting scrollLeft of your element:
document.querySelector('#tab-primary-wrapper .inner-wrapper').addEventListener('mousewheel', function(e: WheelEvent) {
this.scrollLeft += e.deltaY;
e.preventDefault();
});