[英]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.