|
对于“WeX5界面模块化的使用—如何显示声明依赖” ,我通过文档中心的材料知道如何实现,但是在自己编写一个测试程序的时候发现一些问题,请专家指教:
系统提供的案例中CORDOVA的插件引用“downloader”的例子,我打开INDEX.W及查看INDEX.JS没有任何报错及报警提示,测试成功。但是我自己按照它的模式自己编写一个小程序,内容和案例一模一样(或者直接把案例程序拷贝过来)发现一个现象:有许多报错提示,让我不知道如何处理。
案例程序:UI2\demo\native\downloader\index.jsdefine(function(require) {
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
require("$UI/system/lib/cordova/cordova");
require("cordova!org.apache.cordova.file");
require("cordova!de.fastr.phonegap.plugins.downloader");
var Model = function() {
this.callParent();
};
Model.prototype.initdownloaderClick = function(event) {
var fileName = downloader.get("http://yourhost.de/some.zip", "3f4ea2219aa321ef5cd3143ea33076ab");
justep.Util.hint("文件lujun"+fileName + "下载成功");
};
Model.prototype.multidownClick = function(event) {
var fileNames = downloader.getMultipleFiles([ {
url : "http://yourhost.de/some1.zip"
}, {
url : "http://yourhost.de/some2.zip"
}, {
url : "http://yourhost.de/some3.zip"
} ]);
justep.Util.hint("文件some1.zip,some2.zip,some3.zip下载成功!");
};
Model.prototype.modelLoad = function(event) {
downloader.init({
folder : "apptest",
unzip : true,
check : true
});
};
Model.prototype.button1Click = function(event){
var isInitialized = window.downloader.isInitialized();
justep.Util.hint("isInitiallized:"+isInitialized);
};
return Model;
});
照搬过来的程序:UI2\test\index.js
define(function(require) {
报错提示:'$' is defined but never used
var $ = require("jquery");
var justep = require("$UI/system/lib/justep");
require("$UI/system/lib/cordova/cordova");
require("cordova!org.apache.cordova.file");
require("cordova!de.fastr.phonegap.plugins.downloader");
var Model = function() {
this.callParent();
};
Model.prototype.initdownloaderClick = function(event) {
报错提示:'downloader' is not defined
var fileName = downloader.get("http://yourhost.de/some.zip", "3f4ea2219aa321ef5cd3143ea33076ab");
justep.Util.hint("文件lujun"+fileName + "下载成功");
};
Model.prototype.multidownClick = function(event) {
报错提示:此行的多个标记
- 'downloader' is not defined
- 'fileNames' is defined but never used
var fileNames = downloader.getMultipleFiles([ {
url : "http://yourhost.de/some1.zip"
}, {
url : "http://yourhost.de/some2.zip"
}, {
url : "http://yourhost.de/some3.zip"
} ]);
justep.Util.hint("文件some1.zip,some2.zip,some3.zip下载成功!");
};
Model.prototype.modelLoad = function(event) {
downloader.init({
folder : "apptest",
unzip : true,
check : true
});
};
Model.prototype.button1Click = function(event){
var isInitialized = window.downloader.isInitialized();
justep.Util.hint("isInitiallized:"+isInitialized);
};
return Model;
});
程序什么都没有变只是我创建一个空的APP项目而已,将案例程序拷贝过来,就显示报错,如何处理?
|
|