当前位置: 首页 > article >正文

uniapp实现文件预览过程

H5实现预览

<template>
    <iframe :src="_url" style="width:100vw; height: 100vh;" frameborder="0"></iframe>
</template>
<script lang="ts">
export default {
    data() {
        return {
            _url: '',
        }
    },
    onLoad(options: {_url: string}) {
        // 第一:https://docs.google.com/viewer?url=
        // 第二:https://view.officeapps.live.com/op/view.aspx?src=
        this._url = `https://view.officeapps.live.com/op/view.aspx?src=${options._url}`
        console.log(this._url,'this._url')
    }
}
</script>

小程序和app预览

                uni.downloadFile({
					    url: url,
					    success: function (res) {
						var filePath = res.tempFilePath;
						uni.openDocument({
							filePath: filePath,
							showMenu: true,
							success: function (res) {
								console.log('打开文档成功');
							}
						});
					}
				});

 

 


http://www.kler.cn/a/153337.html

相关文章:

  • Spring中的事务管理
  • 【RedisTemplate】SpringDataRedis(Spring中对Redis模块的整合)
  • 4-Docker命令之docker kill
  • 基于Intel Ai Analytics Toolkit 及边缘计算的溶氧预测水产养殖监测方案
  • Python---文件和文件夹操作
  • 操作系统导论——第36章 I/O设备
  • mac电脑下载Netflix Mac(奈飞客户端)安装教程
  • SpringCloud 微服务全栈体系(十八)
  • XML Schema中的elementFormDefault
  • 解决 Python中错误 TypeError: Not All Arguments Converted During String Formatting
  • git的相关实用命令
  • xss漏洞后端进行html消毒
  • zookeeper心跳检测 (实操课程)
  • Milvus入门手册1.0
  • zabbix监控
  • 【力扣周赛】第 369 场周赛(⭐记忆化搜索 树形DP)
  • 网络安全应急响应-Server2228(环境+解析)
  • 代码随想录二刷 |字符串 |右旋转字符串
  • 华为云SDK的全部Maven参考
  • ChatGPT 上线一周年