当前位置:网站首页>Apiccloud implements the document download and preview functions
Apiccloud implements the document download and preview functions
2022-06-26 11:14:00 【The broad sea leaps with the fish_ api】
There are a lot of document downloads app, Especially the functions commonly used in enterprise applications . Use APICloud 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 : APICloud Customize loader explain – mobile phone APP Development 、APP Make 、APP Customized platform
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>边栏推荐
猜你喜欢

QT connection MySQL data query failed

统计遗传学:第一章,基因组基础概念

Machine learning PCA - Experimental Report

(Typora图床)阿里云oss搭建图床+Picgo上传图片详细教程

介紹一下實現建模中可能用到的時間序列預測之線性二次移動平均,Excel的簡單操作
![Compréhension approfondie de l'expérience de port série stm32 (registre) [Tutoriel de niveau nounou]](/img/b2/f09e220918a85b14a1993aa85f7720.png)
Compréhension approfondie de l'expérience de port série stm32 (registre) [Tutoriel de niveau nounou]

【深度学习理论】(6) 循环神经网络 RNN

Redis的最佳实践?看完不心动,算我输!!

. Net, the usage of log components NLog, seriallog, log4net
![LeetCode 710 黑名单中的随机数[随机数] HERODING的LeetCode之路](/img/58/2a56c5c9165295c830082f8b05dd98.png)
LeetCode 710 黑名单中的随机数[随机数] HERODING的LeetCode之路
随机推荐
最牛X的CMDB系统
9、 Beautify tables, forms, and hyperlinks
有手就行的移动平均法、指数平滑法的Excel操作,用来时间序列预测
mysql性能监控和sql语句
Machine learning PCA - Experimental Report
互联网对抗神器之漏洞扫描与反渗透
CEPH operation and maintenance common instructions
laravel 写原生SQL语句
Machine learning SVM - Experimental Report
express在nodejs中的基本使用
24 个必须掌握的数据库面试问题!
深度理解STM32的串口实验(寄存器)【保姆级教程】
机器学习LDA——实验报告
UDP Flood攻击防御原理
Grain Mall - High Availability Cluster
[work details] March 18, 2020
laravel 安装报错 Uncaught ReflectionException: Class view does not exist
SVN 安装配置
This paper introduces the simple operation of realizing linear quadratic moving average of time series prediction that may be used in modeling and excel
Detailed explanation of MySQL fuzzy query