linwe
2024-08-08 3c738f4fe2762bba8087e5a22fc0dc06560eab0e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
<template>
    <view></view>
</template>
 
<script>
    import {
        minioBaseUrl
    } from "@/common/setting.js"
 
    export default {
        data() {
            return {
 
            }
        },
        onLoad(option) {
            this.showPdf(option.url)
        },
        methods: {
            showPdf(url) {
                //打开pdf文件
                wx.showLoading({
                    title: "加载中...",
                });
                wx.downloadFile({
                    url: `${minioBaseUrl}${url}`,
                    success: function(res) {
                        const filePath = res.tempFilePath;
                        wx.openDocument({
                            filePath: filePath,
                            success: function(res) {
                                wx.hideLoading();
                            },
 
                            complete: function(err) {
                                console.log("complete===>", err);
                            },
                            fail: function(res) {
                                console.log("打开失败");
                            },
                        });
                    },
                });
            },
        }
    }
</script>
 
<style>
</style>