- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
返回以下错误 Type '{ class: string; onmousewheel: (e: any) => void; }' is n-6ren">
我想知道为什么这段代码
<div class="home" on:mousewheel="{e=>handleScroll(e)}"></div>
返回以下错误
Type '{ class: string; onmousewheel: (e: any) => void; }' is not assignable to type 'HTMLProps'.Property 'onmousewheel' does not exist on type 'HTMLProps'.
这只是出于好奇,因为即使出现错误,它也能完美运行。
附言。我正在使用 TypeScript
最佳答案
鼠标滚轮事件是deprecated according to MDN并且不会在 Firefox 中工作。因为它是非标准的,所以不包含在 JSX typings 中由 Svelte 使用。
最好使用标准wheel event ,它取代了鼠标滚轮。如果真的要用事件,可以enhance the Svelte typings在一个单独的文件中:
// additional-svelte-jsx.d.ts
declare namespace svelte.JSX {
interface HTMLAttributes<T> {
onmousewheel?: (event: any) => any;
}
}
关于typescript - 鼠标滚轮功能在 svelte 上返回错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66354346/
我相信绝大多数小伙伴在自学python时,运用pycharm进行编写程序时发现字体太小不方便进行编写,通常像codeblocks这样的编程软件可以通过“ctrl+滚轮”进行放大和缩小。而
在我的应用程序中,我使用了 Scroller零件。我似乎无法弄清楚我应该在哪个事件上设置一个监听器以便知道何时滚动内容。我试过Event.CHANGE在 Scroller.verticalScroll
我正在使用一个简单的 progressDialog,它运行正常但轮子没有进步: //Progress Dialog final ProgressDialog dialo
我想在点击文本字段时关闭键盘,以便为该文本字段下方的选择器留出空间。 struct ContentView: View { @State private var date = Date()
我是一名优秀的程序员,十分优秀!