<template> <div> <div v-for="i in numPages" :key="i" style="display: inline-block; width: 25%; margin: 2%; " @click="showPdf(i)" > <pdf :src="src" :page="i"></pdf> </div> </div></template><script>import pdf from 'vue-pdf'var loadingTask = pdf.createLoadingTask('pdfPath')export default { components: { pdf }, data() { return { src: loadingTask, numPages: undefined, } }, methods: { showPdf(p) { //do something console.log(p); } }, mounted() { this.src.promise.then(pdf => { this.numPages = pdf.numPages; }); }}</script>