<template>
<div>
<pdf v-for="i in numPages"
:key="i"
:src="src"
:page="i"
style="display: inline-block; width: 25%"></pdf>
</div>
</template>
<script>
import pdf from 'vue-pdf'
var loadingTask = pdf.createLoadingTask('https://cdn.mozilla.net/pdfjs/tracemonkey.pdf');
export default {
components: {
pdf
},
data() {
return {
src: loadingTask,
numPages: undefined,
}
},
mounted() {
console.log('this.src', this.src)
this.src.promise.then(pdf => {
this.numPages = pdf.numPages;
}).catch(err => {
console.log('err', err)
});
}
}
</script>
以上是全部代码,本地可以,线上就不行
明明已经用了then方法,为啥无效
这个报错先解决看看