12345678910111213141516171819202122232425262728293031323334353637383940 |
- <template>
- <view class="pdf-container">
- <view id="demo"></view>
- </view>
- </template>
- <script>
- import Pdfh5 from "pdfh5";
- export default {
- name: 'App',
- data() {
- return {
- pdfh5: null,
- pdfUrl: ''
- };
- },
- onLoad(page) {
- if (page.fileUrl) {
- this.pdfUrl = page.fileUrl
- }
- },
- mounted() {
- //实例化
- this.pdfh5 = new Pdfh5("#demo", {
- pdfurl: this.pdfUrl
- });
- //监听完成事件
- this.pdfh5.on("complete", function(status, msg, time) {
- console.log("状态:" + status + ",信息:" + msg + ",耗时:" + time + "毫秒,总页数:" + this.totalNum)
- })
- }
- }
- </script>
- <style lang="scss" scoped>
- @import "./pdfh5.css";
- .pdf-container {
- width: 100%;
- min-height: calc(100vh - 88rpx);
- }
- </style>
|