uniapp实现app的pdf预览

实现效果

文件准备

static下添加该pdf文件(下载地址:https://gitee.com/shallow-winds/resource_package/tree/master/方法一/html)

使用web-view进行展示:

在这里插入代码片`

复制代码
<web-view :src="url"></web-view>`
data() {
			return {
                url: '',
                viewerUrl: '/static/html/web/viewer.html?file=',
			}
		},

将viewerUrl与pdf地址进行拼接:

复制代码
getquery(id){
                uni.showLoading({
					title: '加载中'
				});
				this.$http.request({
					url: ``,
					method: 'post',
					
				}).then(res => {
					this.url = this.viewerUrl + res.data.articlesUrl
					uni.hideLoading();
				}).catch(res => {
				})
            }
相关推荐
CHB9 小时前
uni-app x 蒸汽模式 性能测试基准报告 Benchmark
uni-app·harmonyos
anyup14 小时前
月销 8000+,uView Pro 让 uni-app 跨端开发提速 10 倍
前端·uni-app·开源
willow4 天前
uniapp实战
uni-app
只会cv的前端攻城狮4 天前
兼容性地狱-Uniapp钉钉小程序环境隔离踩坑实录
前端·uni-app
codingWhat6 天前
小程序里「嵌」H5:一套完整可落地的 WebView 集成方案
前端·uni-app·webview
小时前端7 天前
微信小程序选不了本地文件?用 web-view + H5 一招搞定
前端·微信小程序·uni-app
Mr_li7 天前
给 Vue 开发者的 uni-app 快速指南
vue.js·uni-app
anyup8 天前
🔥2026最推荐的跨平台方案:H5/小程序/App/鸿蒙,一套代码搞定
前端·uni-app·harmonyos
Mintopia9 天前
Vue3 项目如何迁移到 uni-app x:从纯 Web 到多端应用的系统指南
uni-app
Mintopia9 天前
uni-app x 发展前景技术分析:跨端统一的新阶段?
uni-app