uniapp安卓本地文件读取(html5+)
plus.io.resolveLocalFileSystemURL(
"_www/static/caise.json",//static下路径
function(entry){ //获取文件对象
console.log("entry:"+entry.fullPath);
entry.file( function ( file ) {
//console.log(file);
var reader = new plus.io.FileReader();
reader = new plus.io.FileReader();
reader.onloadend = function ( e ) {
console.log( "Read success" );
// console.log( e.target.result );
console.log( JSON.parse(e.target.result ));
};
reader.readAsText( entry.fullPath );
}, function ( e ) {
//alert( e.message );
} );
}
)
"_www/static/caise.json",//static下路径
function(entry){ //获取文件对象
console.log("entry:"+entry.fullPath);
entry.file( function ( file ) {
//console.log(file);
var reader = new plus.io.FileReader();
reader = new plus.io.FileReader();
reader.onloadend = function ( e ) {
console.log( "Read success" );
// console.log( e.target.result );
console.log( JSON.parse(e.target.result ));
};
reader.readAsText( entry.fullPath );
}, function ( e ) {
//alert( e.message );
} );
}
)