FranckFreiburger / vue-pdf

vue.js pdf viewer

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Failed to resolve async component

daniel-lij opened this issue · comments

`

{{ item.title }}
<script> import pdf from 'vue-pdf' export default { name: 'Pdf', components: { pdf, }, data() { return { pdfList: [ { pdfUrl: 'https://dakaname.oss-cn-hangzhou.aliyuncs.com/file/2018-12-29/1546049718768.pdf', title: '你好,2019年', }, { pdfUrl: 'http://file.gp58.com/file/2018-11-14/111405.pdf', title: '中信证券观点', }, { pdfUrl: 'https://dakaname.oss-cn-hangzhou.aliyuncs.com/file/2018-12-28/1546003237411.pdf', title: '12月投资月刊', }, { pdfUrl: 'https://dakaname.oss-cn-hangzhou.aliyuncs.com/file/2018-12-28/1546003282521.pdf', title: '丰岭资本观点', }, ], pdfUrl: '', numPages: 1, activeIndex: 0, } }, mounted: function() { this.pdfTask(this.pdfList[0].pdfUrl) }, methods: { pdfTask(pdfUrl) { var self = this var loadingTask = pdf.createLoadingTask(pdfUrl) loadingTask .then((pdf) => { self.pdfUrl = loadingTask self.numPages = pdf.numPages }) .catch((err) => { console.error(err) }) }, pdfClick(pdfUrl, index) { if (index === this.activeIndex) return this.activeIndex = index this.pdfUrl = null this.pdfTask(pdfUrl) }, }, } </script>

`

error
`
Failed to resolve async component: function AsyncHandler() {return {
component: AsyncView,

`
99f1c0bea723aea7a1ac1b9d1c80493
09f868e216b40d6a79a8b7f5df54d44

`

{{ item.title }}

<script> import pdf from 'vue-pdf' export default { name: 'Pdf', components: { pdf, }, data() { return { pdfList: [ { pdfUrl: 'https://dakaname.oss-cn-hangzhou.aliyuncs.com/file/2018-12-29/1546049718768.pdf', title: '你好,2019年', }, { pdfUrl: 'http://file.gp58.com/file/2018-11-14/111405.pdf', title: '中信证券观点', }, { pdfUrl: 'https://dakaname.oss-cn-hangzhou.aliyuncs.com/file/2018-12-28/1546003237411.pdf', title: '12月投资月刊', }, { pdfUrl: 'https://dakaname.oss-cn-hangzhou.aliyuncs.com/file/2018-12-28/1546003282521.pdf', title: '丰岭资本观点', }, ], pdfUrl: '', numPages: 1, activeIndex: 0, } }, mounted: function() { this.pdfTask(this.pdfList[0].pdfUrl) }, methods: { pdfTask(pdfUrl) { var self = this var loadingTask = pdf.createLoadingTask(pdfUrl) loadingTask .then((pdf) => { self.pdfUrl = loadingTask self.numPages = pdf.numPages }) .catch((err) => { console.error(err) }) }, pdfClick(pdfUrl, index) { if (index === this.activeIndex) return this.activeIndex = index this.pdfUrl = null this.pdfTask(pdfUrl) }, }, } </script>

`

error ` Failed to resolve async component: function AsyncHandler() {return { component: AsyncView,

` 99f1c0bea723aea7a1ac1b9d1c80493 09f868e216b40d6a79a8b7f5df54d44

  • vue-pdf version 4.30
  • vue.js version vue2.x
  • webpack version 4.46.0
  • browser version 101.0.4951.67
  • OS version window 10