12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- <template>
- <view class="pdf-view"> <view id="demo"></view> </view>
- </template>
- <script>
- // import Pdfh5 from 'pdfh5'
- import 'pdfh5/css/pdfh5.css'
- export default {
- data() {
- return {
- pdfh5: null,
- pdfurl: '',
- title: ''
- }
- },
- onLoad(option) {
- console.log(option)
- this.pdfurl = option.url
- this.title = option.title || ''
- uni.setNavigationBarTitle({
- title: this.title
- })
- },
- onReady() {
- //实例化
- // console.log(Pdfh5)
- // this.pdfh5 = new Pdfh5('#demo', {
- // pdfurl: this.pdfurl,
- // lazy: true
- // })
- // //监听完成事件
- // this.pdfh5.on('complete', function(status, msg, time) {
- // console.log('状态:' + status + ',信息:' + msg + ',耗时:' + time + '毫秒,总页数:' + this.totalNum)
- // })
- }
- }
- </script>
- <style lang="scss">
- .pdf-view {
- width: 100%;
- height: 100vh;
- }
- </style>
|