There are a lot of document downloads app, Especially the functions commonly used in enterprise applications . Use APICloud(www.apicloud.com) Development app when , have access to api.download Method implementation Download ; Preview the document using superFile modular .superFile The module encapsulates the browsing service based on Tencent TBS, Use X5Webkit kernel , Realize the display function of documents , Support multiple file formats (PDF、Word、Execl、TXT、PPT).
Add... To the project superFile modular :

Then compile the custom loader , Put custom loader Install the installation package on the mobile phone , And then you can use it APICloud Studio3 wifi sync , Synchronize code to custom loader Debugging in . Reference tutorial : https://docs.apicloud.com/Dev-Guide/Custom_Loader
The example code is as follows :
<template>
<safe-area>
<scroll-view class="main" scroll-y>
<view><text onclick='this.downloadDoc_open'> Download and open document </text></view>
</scroll-view>
</safe-area></template><style>.main { width: 100%; height: 100%; background-color: #fff;
}</style><script>export default { name: 'test',
data() { return {
}
},
apiready() {
}, methods: {
downloadDoc_open() {
api.download({ url: '', // Fill in the file to download url
savePath: 'fs://myapp/test.doc', report: true, cache: true, allowResume: true
}, function (ret, err) { if (ret.state == 1) { // Download successful
console.log(JSON.stringify(ret)); if (api.systemType == 'ios') { // ios No initialization required , direct open
var superFile = api.require('superFile');
superFile.open({ path: ret.savePath,
})
} if (api.systemType == 'android') { console.log(2); var superFile = api.require('superFile');
superFile.init(function (ret) { if (ret.eventType == 'onViewInitFinished') {
superFile.open({ path: ret.savePath
})
}
});
}
}
});
}
}
}</script>





![[Yugong series] February 2022 wechat applet -app Subpackages and preloadrule of JSON configuration attribute](/img/94/a2447b3b00ad0d8fb990917531316d.jpg)

![In 2021, China's deposit balance continued to grow, and the balance of RMB and foreign currency deposits reached a record high [figure]](/img/23/652f596091dde97031a27bdbccdd0f.jpg)

