在用npm install jquery-ui之后如何引入项目并使用
在用webpack或者creact react 构建的前端项目中,如果我们要用jquery-ui一定要像如下这样:
import $ from 'jquery'; //必须引入jquery import 'jquery-ui/themes/base/draggable.css'; //此css不引入也不影响draggable 功能 import 'jquery-ui/themes/base/resizable.css'; //使用resizable功能必须引入此css! import 'jquery-ui/ui/widgets/draggable'; //必须像如下这样直接引入,import 'jquery-ui' 这样引入是无效的 import 'jquery-ui/ui/widgets/resizable';
像上面这样引入之后正常使用就行:
$(".rendition-modal-window").resizable({ minHeight: 150, minWidth: 200 });
$(".rendition-modal-window").draggable({ cancel: "div.modal-body " });