当前位置:网站首页>Uni app solves the problem of unable to browse PDF files online
Uni app solves the problem of unable to browse PDF files online
2022-07-16 07:59:00 【Little Ali】
1. download pdf.js
website :https://mozilla.github.io/pdf.js/
Download either one ( The first is the new browser , The second is the old browser )
2. Put the downloaded file into the project
I put it here static Folder and change the file name to pdf, Any other position is OK , Just know that the path is written correctly when importing 
3. Create a page to show pdf
vue 3.X edition
<template>
<view >
<web-view :src="obj.u"></web-view>
</view>
</template>
<script setup>
import {
onLoad} from '@dcloudio/uni-app'
import {
ref,onMounted,reactive} from 'vue'
const obj = reactive({
viewerUrl: '../../static/pdf/web/viewer.html',
u:''
})
onLoad((options)=>{
// Receive here pdf Address Parameters can be passed through components options Just put the receiver at the address below
let url = encodeURIComponent("http://192.168.1.114:4000/1.pdf")
url = "../../static/pdf/web/viewer.html?file=" + url;
obj.u = url
})
</script>
<style>
</style>
4. Display the results

5. Existing problems
- There are some catons , The content needs to be loaded repeatedly ( The solution has not been found yet , Charges in the plug-in market )
边栏推荐
- Redis主从集群搭建及哨兵模式配置
- IDEA 注释模板,这样配置才够逼格!
- Dynamic programming + combinatorial mathematics
- Idea annotation template, such configuration is enough!
- The difference between set, map, weakset and weakmap
- Generics of C #
- Alipay computer website payment
- Are you still using the strategy mode to solve if else? Map+ functional interface method is yyds
- Introduction to C language compiler
- Day 17 of leetcode
猜你喜欢

Attack and defense World Web

C # use autoupdater NET

WordPress Chinese website code download

Concurrent simulation of program ape's exclusive "pressure test tool"

1、 Disk data recovery experiment report

重发布实验

c#使用MQTT通信

C # use tcplistener for chat communication

26 years old, has worked in automation for three years, and the monthly salary is only 12K. Can you change jobs and find a higher salary job?

一次简单的 JVM 调优,拿去写到简历里
随机推荐
快速幂求解a^b%p
Introduction to C language compiler
Druid database connection pool monitoring page
Redis can only cache? Too out!
win11不兼容vm--VMware Workstation解决办法。2022年3月31日,亲测成功解决
1、 Disk data recovery experiment report
XPath超详细总结
prism发布订阅
prism对话服务
Day 15 of leetcode
Set、Map、WeakSet 和 WeakMap 的区别
64位整除乘法
Byte test director stayed up for 10 days, and the test post interview script came out of the liver, giving you wings to your big factory dream~
Jsonp principle
wordpress中文网站代码下载
Dynamic open point segment tree
File management - Alibaba cloud OSS learning (I)
Fundamentals of information security
Principe jsonp
项目上线之gzip和pm2管理工具的基本使用