12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061 |
- <template>
-
- <view class="container">
- <!-- <cu-custom bgColor="bg-gradual-pink" :isBack="true">
- <block slot="backText">返回</block>
- <block slot="content">检测报告</block>
- </cu-custom> -->
-
- <web-view :src="pdfUrl"></web-view>
- </view>
- </template>
- <script>
- export default {
- data() {
- return {
- pdfUrl:'',
- from:'app'
- }
- },
- onLoad(option) {
- console.log("接收参数")
- console.log(option)
- /**
- * 浏览情景
- */
-
- // 浏览情景1:浏览本地的pdf文件
- //this.pdfUrl = '/hybrid/html/web/viewer.html?file=./compressed.tracemonkey-pldi-09.pdf'
-
- // 浏览情景2:浏览在线的pdf文件
- this.pdfUrl = '/hybrid/html/web/viewer.html?file='+encodeURIComponent("https://www.szjyxt.com/group1/M00/00/0C/rBKdLGHuElCAVpUEAAY6VxViWJE056.pdf")
- },
- methods: {
- /**
- * 下载情景
- */
- downloadPdfClick(){
- // 下载情景1:h5内嵌app,通过分享给朋友的方式进行下载
- if(this.from == 'app'){
- let item = 'https://www.szjyxt.com/h5/hybrid/html/web/pdf.html?shareUrl='+encodeURIComponent(this.bgUrl)
- +'&shareTitle=PDF文件';
- window.open(item);
- return;
-
- }else if(this.from == 'wx wq'){
- // 下载情景2:h5内嵌微信小程序,从h5页面跳转到小程序页面后,然后通过调用小程序原生API进行下载
- // 注意: 先要引入微信jssdk [命令: npm install jweixin-module]
- // this.$wx.miniProgram.navigateTo({
- // url: '/pages/pdf/pdf_download?pdf='+ encodeURIComponent(this.bgUrl) //小程序页面链接
- // });
- }
-
- }
- }
- }
- </script>
- <style>
- </style>
|