uniapp实现文件预览过程

H5实现预览

vbscript 复制代码
<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预览

CoffeeScript 复制代码
                uni.downloadFile({
					    url: url,
					    success: function (res) {
						var filePath = res.tempFilePath;
						uni.openDocument({
							filePath: filePath,
							showMenu: true,
							success: function (res) {
								console.log('打开文档成功');
							}
						});
					}
				});
相关推荐
码兄科技5 天前
24小时自助健身房系统软件开发实战指南:功能设计与部署方案
java·spring boot·uni-app
2501_916007476 天前
苹果商店iOS应用上架费用全面解析:开发者计划与审核费用计算
android·ios·小程序·https·uni-app·iphone·webview
2501_916008896 天前
如何实现iOS App代码混淆:SwiftShield使用指南
android·ios·小程序·https·uni-app·iphone·webview
2501_916008896 天前
怎么用 Godot 导出 iOS 应用并上架 App Store?签名字段该填什么?
android·ios·小程序·https·uni-app·iphone·webview
郑州光合科技余经理6 天前
同城外卖小程序开发:下单成功后,后台导出能不能对上用户端状态
开发语言·前端·git·后端·uni-app·php·ai编程
白远山7 天前
城市电竞陪玩调度系统实战:从派单算法到多端协同的架构拆解
java·架构·uni-app·需求分析
白远山7 天前
上海24小时自助健身房系统软件开发实战指南
java·架构·uni-app·需求分析
白远山8 天前
上海24小时自助健身房系统软件开发实战指南:从需求到部署
java·架构·uni-app·需求分析
海鸥两三9 天前
小程序文档预览 · 进阶面试题
小程序·uni-app·uniapp
海鸥两三9 天前
微信小程序 PDF 预览实践(uni.downloadFile → uni.openDocument)
小程序·uni-app