在用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