使用jszip.js,read.js.
传入fileinput选中的文件对象
function handleFile(f) {
JSZip.loadAsync(f)
.then(function(zip) {
vm.$data.zipFileArry = [];
zip.forEach(function(relativePath, zipEntry) {
let name = zipEntry.name;
if(name.indexOf('.html') > -1) {
vm.$data.zipFileArry.push({
"name": name
});
$zipItemTable.bootstrapTable('load', vm.$data.zipFileArry);//结合bootstrap-table使用
}
});
}, function(e) {
$result.append($("<div>", {
"class": "alert alert-danger",
text: "Error reading " + f.name + ": " + e.message
}));
});
}