Skip to content

Commit 26be619

Browse files
committed
📝 add how to use useLicense
1 parent 661f99b commit 26be619

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

src/components/PdfViewer.vue

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,22 @@
11
<script setup lang="ts">
2-
import { VPdfViewer } from '@vue-pdf-viewer/viewer';
2+
import { onBeforeMount, watch, ref } from "vue";
3+
import { VPdfViewer, useLicense } from "@vue-pdf-viewer/viewer";
4+
5+
const vpvRef = ref<InstanceType<typeof VPdfViewer> | null>(null);
6+
onBeforeMount(() => {
7+
useLicense({ licenseKey: "your-license-key" });
8+
});
9+
watch(
10+
vpvRef,
11+
(newVal) => {
12+
console.log("These are VPV instance properties", Object.keys(newVal));
13+
},
14+
{ deep: true }
15+
);
316
</script>
417
<template>
5-
<VPdfViewer
6-
v-bind="$attrs"
7-
src="https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf" />
18+
<VPdfViewer
19+
v-bind="$attrs"
20+
ref="vpvRef"
21+
src="https://raw.githubusercontent.com/mozilla/pdf.js/ba2edeae/web/compressed.tracemonkey-pldi-09.pdf" />
822
</template>

0 commit comments

Comments
 (0)