【发布时间】:2017-01-13 21:16:01
【问题描述】:
我有 jQuery 范围滑块小部件,我可以这样导入和使用:
declare var jQuery: any;
import 'jquery-ui/ui/widgets/slider';
import 'jquery-ui/ui/widgets/mouse';
并像这样使用它:
jQuery(this.elementRef.nativeElement).find('#range-slider').slider({..});
我的滑块工作正常。
问题是我需要启用移动触摸的滑块,所以我导入了 jQuery UI Touch Punch:
declare var jQuery: any;
import 'jquery-ui/ui/widgets/slider';
import 'jquery-ui/ui/widgets/mouse';
import 'jquery-ui-touch-punch';
但它错误:
TypeError: Cannot read property 'prototype' of undefined
显然它找不到 jQuery 和 jQuery UI。但是,当导入的 jQuery 不在全局范围内时,如何通过 jQuery 来触摸打孔?
我在我的项目中使用this 样板。
【问题讨论】:
-
这个运气好吗?我现在正在努力解决这个问题......
-
很遗憾没有,我最终使用了支持移动触摸事件的ionden.com/a/plugins/ion.rangeslider。
标签: jquery jquery-ui angular webpack jquery-ui-touch-punch