杨磊
4 天以前 ef37c59e055a990ce247b265b27d3fcef430a243
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<template>
  <div class="global">
    <div class="wrapIframe">
      <iframe
        class="iframe"
        scrolling="no"
        :src="config.pdfUrl"
        @load="loadIframe"
        allowfullscreen="true"
        ref="iframeref"
      ></iframe>
    </div>
  </div>
</template>
 
<script>
import config from "@/assets/js/config";
 
export default {
  props: {
    path: String
  },
  data() {
    return {
      currentPage: 1
    };
  },
  mounted() {},
  created() {
    scrollTo(0, 0);
    this.getData();
  },
  methods: {
    getData() {},
    loadIframe() {
      let that = this;
      that.$refs.iframeref.contentWindow.postMessage(
        {
          MD5: this.$route.query.md5,
          url: that.config.requestCtx,
          currentPage: that.currentPage,
          index: 1,
          token: true // 购买了传,没购买传试读页,没有登录传true
        },
        "*"
      );
    }
  }
};
</script>
 
<style scoped>
.global {
  width: 100%;
  height: 100vh;
  background: #333;
  box-sizing: border-box;
}
.wrapIframe {
  height: 100%;
  box-sizing: border-box;
}
.iframe {
  display: block;
  width: 100%;
  height: 100%;
  border: medium none;
}
</style>