我创建简单的测试程序来证明我的问题browserify的jQuery + jQuery的用户界面并不适用于我
https://github.com/alexey2baranov/jquery-ui-broken-demo
在这个演示中,我首先是龙头安装的jQuery和jQuery UI的
npm install --save jquery jquery-ui
然后创建简单的测试脚本
window.$ = window.jQuery = require("jquery");
require('jquery-ui');
$(function(){
$('#qwerty').draggable();
});
,并与BR将它们编owserify
browserify --debug index.js -o dist/index.js
在最终的步骤我装browserify结果到测试HTML页面
<head>
<script src="dist/index.js"></script>
</head>
<body>
<div id="qwerty" style="position: absolute; width: 100px; height: 100px; background-color: #0b3e6f">123</div>
</body>
,并获得在Chrome控制台此错误
jQuery.Deferred exception: $(...).draggable is not a function TypeError: $(...).draggable is not a function at HTMLDocument. undefined index.js [sm]:10Uncaught TypeError: $(...).draggable is not a function
这有什么错我的代码?
鉴于此错误消息,出于某种原因,您包含的jQueryUI库无法正常工作。 –
Yap!希望sombody得到相同的错误,并可以修复它 – alexey2baranov