简体   繁体   English

如何在余烬浏览器中使用jQuery文件上传

[英]how to use jquery file upload with ember browserify

I'm trying to use jquery file upload with ember-cli using the npm package https://www.npmjs.com/package/blueimp-file-upload 我正在尝试使用npm软件包https://www.npmjs.com/package/blueimp-file-upload在ember-cli中使用jquery文件上传

and ember browserify. 并嵌入浏览器。

I installed ember-browserify and blueimp-file-upload: 我安装了ember-browserify和blueimp-file-upload:

$ npm install --save-dev ember-browserify
$ npm install --save-dev blueimp-file-upload

Importing fileupload like so: 像这样导入文件上传:

import fileupload from 'npm:blueimp-file-upload';

Gave me this error: Cannot find module 'jquery' from '/Users/tony/src/myapp/node_modules/blueimp-file-upload/js/vendor' 给我这个错误:无法从'/ Users / tony / src / myapp / node_modules / blueimp-file-upload / js / vendor'中找到模块'jquery'

So I installed jquery via npm as well: 所以我也通过npm安装了jquery:

$ npm install --save-dev jquery

Now I just get this error when trying to use fileupload: 现在,当我尝试使用fileupload时,我仅收到此错误:

$(...).fileupload is not a function

Is there a better way to use jquery-fileupload with ember-cli? 有没有更好的方法将ember-cli与jquery-fileupload一起使用?

First, there is a few plugins for ember that provide you with a ready-to-use solution. 首先,有几个用于ember的插件为您提供了现成的解决方案。 If I remember right, one of them utilizes blueimp file upload. 如果我没记错的话,其中一个利用blueimp文件上传。 You may use one of them or look how they use underlying jquery plugins. 您可以使用其中之一,也可以查看它们如何使用基础的jquery插件。

You may also try to install jquery-ui-widget and blueimp-file-upload via bower. 您也可以尝试通过Bower安装jquery-ui-widget和blueimp-file-upload。

And finally, you may write your own file uploader without using 3rd-party jquery plugins. 最后, 您可以编写自己的文件上传器,而无需使用第三方的jquery插件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM