vword.vue 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201
  1. <template>
  2. <!--使用 pdfvuer 实现 滑动浏览 单印章-->
  3. <div class="pdf">
  4. <div class="loading" v-show="isloading">
  5. <span>可能会加载时间有点长,请耐心等待...</span>
  6. </div>
  7. <iframe
  8. ref="viframe"
  9. style="width: 100%; height: 800px; border: none"
  10. :src="pdfUrl"
  11. ></iframe>
  12. </div>
  13. </template>
  14. <script>
  15. export default {
  16. name: "Pdfvuer",
  17. components: {
  18. // pdf: pdfvuer,
  19. },
  20. props: {
  21. // 当前pdf路径
  22. pdfUrl: {
  23. type: String,
  24. default:
  25. "https://ccrb.s3.cn-northwest-1.amazonaws.com.cn/0629%E5%AE%9E%E6%97%B6%E8%AF%BE%E5%A0%82%E6%A8%A1%E6%8B%9F%E6%BC%94%E7%A4%BA%E8%AF%BE%E4%BB%B61656920880446.pdf",
  26. },
  27. ppage: {
  28. type: Number,
  29. default: 1,
  30. },
  31. },
  32. data() {
  33. return {
  34. page: 1, // 当前页
  35. numPages: 0, // 总页数
  36. pdfData: undefined,
  37. inputPage: 1, // 输入的页码
  38. isloading: false,
  39. scale: "page-width",
  40. };
  41. },
  42. mounted() {
  43. let _this = this;
  44. _this.isloading = true;
  45. _this.$refs.viframe.onload = function () {
  46. _this.isloading = false;
  47. };
  48. console.log(_this.isloading);
  49. // this.getPdf();
  50. },
  51. beforeDestroy() {},
  52. watch: {
  53. pdfUrl: function (s) {
  54. let _this = this;
  55. _this.isloading = true;
  56. _this.$refs.viframe.onload = function () {
  57. _this.isloading = false;
  58. };
  59. console.log(_this.isloading);
  60. // this.getPdf();
  61. },
  62. },
  63. methods: {
  64. },
  65. };
  66. </script>
  67. <style scoped>
  68. .loading {
  69. height: 100%;
  70. width: 100%;
  71. /* background: #000; */
  72. position: absolute;
  73. display: flex;
  74. align-items: center;
  75. justify-content: center;
  76. /* background-color: rgba(255, 255, 255, 0.7); */
  77. background-color: rgba(255, 255, 255, 1);
  78. z-index: 9;
  79. font-size: 20px;
  80. color: #007fff;
  81. }
  82. .pdf {
  83. height: 100%;
  84. width: 100%;
  85. position: relative;
  86. box-sizing: border-box;
  87. overflow-x: hidden;
  88. overflow-y: auto;
  89. }
  90. .pdf .show {
  91. margin: auto;
  92. width: 100%;
  93. display: flex;
  94. flex-wrap: wrap;
  95. }
  96. .pdf .show .p-pdf {
  97. overflow: hidden;
  98. }
  99. .pdf .show .p-pdf .line {
  100. position: absolute;
  101. width: 50px;
  102. right: -50px;
  103. background: rgb(255, 186, 96);
  104. height: 2px;
  105. }
  106. .pdf .show .p-pdf span {
  107. width: 100%;
  108. text-align: center;
  109. color: #fff;
  110. }
  111. .pdf .show .p-pdf span + span {
  112. margin-top: 10px;
  113. }
  114. .pdfbox {
  115. /* border: 3px solid #000; */
  116. /* box-sizing: border-box; */
  117. /* border-radius: 4px; */
  118. /* overflow: hidden; */
  119. }
  120. .pdf .pdf_footer {
  121. position: sticky;
  122. bottom: 0;
  123. left: 0;
  124. right: 0;
  125. padding: 10px 0;
  126. width: 100%;
  127. height: 75px;
  128. background-color: rgba(255, 255, 255, 0.5);
  129. display: flex;
  130. align-items: center;
  131. justify-content: center;
  132. flex-direction: column;
  133. }
  134. .pdf .pdf_footer .info {
  135. display: flex;
  136. flex-wrap: wrap;
  137. width: 100%;
  138. justify-content: center;
  139. }
  140. .pdf .p-pdf .viewerContainer {
  141. width: 100%;
  142. }
  143. /* .pdf .pdf_footer .info div {
  144. width: 30%;
  145. } */
  146. .pdf .pdf_footer .operate {
  147. margin: 10px 0 0;
  148. display: flex;
  149. flex-wrap: wrap;
  150. justify-content: center;
  151. width: 100%;
  152. }
  153. .pdf .pdf_footer .operate div {
  154. text-align: center;
  155. font-size: 15px;
  156. }
  157. .pdf .pdf_footer .operate .btn {
  158. cursor: pointer;
  159. margin: 5px 10px;
  160. width: 100px;
  161. border-radius: 10px;
  162. padding: 5px;
  163. color: #fff;
  164. background-color: #066ebe;
  165. }
  166. .pdf::-webkit-scrollbar {
  167. /*滚动条整体样式*/
  168. width: 6px;
  169. /*高宽分别对应横竖滚动条的尺寸*/
  170. height: 6px;
  171. }
  172. /*定义滚动条轨道 内阴影+圆角*/
  173. .pdf::-webkit-scrollbar {
  174. border-radius: 10px;
  175. background-color: #b8bdc9;
  176. }
  177. /*定义滑块 内阴影+圆角*/
  178. .pdf::-webkit-scrollbar-thumb {
  179. border-radius: 10px;
  180. -webkit-box-shadow: inset 0 0 6px rgb(96, 125, 184);
  181. background-color: #2c5ab3;
  182. }
  183. </style>