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 => {
				})
            }
相关推荐
spmcor2 天前
身份证读卡“无感登录”方案实践:从手动点击到自动检测
uni-app
PedroQue992 天前
uni-router v1.8.0新增冷启动守卫补执行
前端·uni-app
PedroQue993 天前
uni-router v1.7.0重磅更新:守卫重定向自由掌控
前端·uni-app
一份执念5 天前
uni-app项目 (vue+vite + uni-UI)中引入umd格式JS文件,微信小程序中导入报错处理方案
前端·uni-app·echarts
PedroQue995 天前
V1.6.1性能优化:高频路径提速与代码精简
前端·uni-app
夏碧笔7 天前
uni-app跨端地图实战:用第三方LBS替代微信平台收费服务
uni-app
用户69903048487512 天前
try catch使用场景 处理同步代码错误兼容用的
javascript·uni-app
ITKEY_12 天前
uniapp微信开发者工具 更改AppID失败 touristappid
uni-app
weixin_3975740912 天前
PDF复杂表格的1:1还原引擎:跨页表格自动拼接技术实战
大数据·人工智能·pdf
Metaphor69212 天前
使用 Python 将 PDF 转换为 HTML
python·pdf·html