cordova打开文件_文件打开插件问题(cordova-open)

Model.prototype.openFile = function(fileUrl){

if(this.wx){

warning.onAlert();

}else {

//                        var open = cordova.plugins.disusered.open;

function success() {

console.log('Success');

alert("Success");

}

function error(code) {

alert(code);

if (code === 1) {

console.log('No file handler found');

alert("No file handler found");

} else {

console.log('Undefined error');

alert("Undefined error");

}

}

cordova.plugins.disusered.open(fileUrl, success, error);

}

}

Model.prototype.button2Click = function(event){

this.openFile('http://192.168.8.34/Rec/courseFile/1000100000/201762009311812312/20170508.doc');

};

Model.prototype.button1Click = function(event){

this.openFile('http://192.168.8.34/Rec/courseFile/1000100000/201612070302136078/201612070302136078.ppt');

};

Model.prototype.button3Click = function(event){

this.openFile('http://192.168.8.34/Rec/courseFile/1000100000/201612070239318852/201612070239318852.pptx');

};

Model.prototype.button4Click = function(event){

this.openFile('http://192.168.8.34/Rec/courseFile/1000100000/201762009311812312/2017620095952.docx');

};

Model.prototype.button6Click = function(event){

this.openFile('http://192.168.8.34/Rec/20170504-225935/HD/resource/videos/1_1.mp4');

};

Model.prototype.button5Click = function(event){

this.openFile('http://imgsrc.baidu.com/imgad/pic/item/caef76094b36acaf0accebde76d98d1001e99ce7.jpg');

};

Model.prototype.button7Click = function(event){

this.openFile('http://192.168.8.34/hls/1493174178997_01_H.m3u8');

};

Model.prototype.button10Click = function(event){

this.openFile('http://192.168.8.34/Rec/courseFile/1000100000/201612070239318852/201612070239318852.swf');

};

Model.prototype.button11Click = function(event){

this.openFile('http://192.168.8.34/Rec/courseFile/1000100000/201612070239318852/201612070239318852.pdf');

};

Model.prototype.button12Click = function(event){

this.openFile('rtmp://192.168.8.34/live/1493174178997_01_H');

};

Model.prototype.button8Click = function(event){

this.openFile('http://192.168.8.34/Rec/courseFile/1000100000/201762009311812312/2017620095357.xls');

};

Model.prototype.button9Click = function(event){

this.openFile('http://192.168.8.34/Rec/excel/import_registration_user.xlsx');

};

使用此方法进行文件打开,在安卓系统中没有任何问题,在苹果系统中就出现APP闪退现象。我的IOS版本是10.3.2。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值