简体   繁体   English

带有打字稿的“JQuery”类型上不存在属性“滑块”

[英]Property 'slider' does not exist on type 'JQuery' with typescript

how to come out of this error?如何摆脱这个错误?

 jQuery(this.el.nativeElement.children[0]).slider('option', optionName, this.value); 

Error:错误:

file: 'file:/slider_component/slider.component.ts'
severity: 'Error'
message: 'Property 'slider' does not exist on type 'JQuery'.'
at: '85,55'
source: 'ts'

尝试在组件顶部添加它

declare let jQuery: any;

you should use the jQueryUI, you can get it at http://jqueryui.com/download/你应该使用 jQueryUI,你可以在http://jqueryui.com/download/获得它

jQuery itself doesn't have the slider property jQuery 本身没有滑块属性

Adding jqueryui types to your project may resolve this issue.将 jqueryui 类型添加到您的项目可能会解决此问题。 It did for me, I was using $(".abc").tabs(), and would receive a similar error.它对我有用,我使用的是 $(".abc").tabs(),并且会收到类似的错误。 Adding the types via npm command below resolved.通过下面的 npm 命令添加类型已解决。 Note that you execute this command in your project root using cmd/terminal请注意,您使用 cmd/terminal 在项目根目录中执行此命令

npm i -D @types/jqueryui

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Typescript 中的 jQuery:类型“JQueryStatic”上不存在属性“attr”<HTMLElement> &#39;.ts - jQuery in Typescript: Property 'attr' does not exist on type 'JQueryStatic<HTMLElement>'.ts 为什么使用带有 Angular/TypeScript 的 floatThead 会产生错误 Property 'floatThead' does not exist on type 'JQuery<any> '</any> - Why does using floatThead with Angular/TypeScript yield the error Property 'floatThead' does not exist on type 'JQuery<any>' 使用 Typescript 时如何停止“JQuery 类型上不存在属性”语法错误? - How can I stop “property does not exist on type JQuery” syntax errors when using Typescript? 类型“JQuery”上不存在属性“掩码”<HTMLElement> - Property 'mask' does not exist on type 'JQuery<HTMLElement> Angular 2属性“ jQuery”在Window类型上不存在 - Angular 2 Property 'jQuery' does not exist on type Window 类型“ JQuery”上不存在属性“ kendoGrid” <HTMLElement> - Property 'kendoGrid' does not exist on type 'JQuery<HTMLElement> 属性&#39;jqGrid&#39;在&#39;JQuery&#39;类型的值上不存在 - The property 'jqGrid' does not exist on value of type 'JQuery' 类型“JQuery”上不存在属性“排序”<htmlelement> '</htmlelement> - Property 'sort' does not exist on type 'JQuery<HTMLElement>' 类型“ JQuery”上不存在属性“ tab” - Property 'tab' does not exist on type 'JQuery' 类型“JQuery”上不存在属性“slick”<HTMLElement> &#39; - Property 'slick' does not exist on type 'JQuery<HTMLElement>'
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM