在用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 " });

 


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM