0

我正在使用来自 syncfusion 的 pdf 查看器组件:https
://ej2.syncfusion.com/documentation/pdfviewer/getting-started/ 我注入了一些模块,但我需要在它们上调用一些方法,如何在 Vue 中实现这一点。 js 使用打字稿?

在 main.ts 我有:

import {
    PdfViewer,
    Toolbar,
    Magnification,
    Navigation
} from '@syncfusion/ej2-pdfviewer';

PdfViewer.Inject(
    PdfViewer,
    Toolbar,
    Magnification,
    Navigation
);

然后在其他组件中,我有 pdf 查看器组件,并想在注入的模块上调用一些方法,例如 Navigation 的方法,转到下一页Navigation API

在 Viewer.vue 我有:

<template>
        <ejs-pdfviewer
            id="pdfViewer"
            ref="pdfViewerRef"
            @loadstart="documentLoad"
            @formFieldAdd="signatureAdd"
            :serviceUrl="serviceUrl"
            :documentLoad="documentLoad"
            :documentLoadFailed="documentLoadFailed"
            :enableToolbar="true"
            :enableCustomStamp="false"
            :enablePrint="false"
            :enableNavigation="true"
            :enableAnnotation="true"
            :enableThumbnail="true"
            :enableFormFields="true"
            :isThumbnailViewOpen="false"
            :enableNavigationToolbar="true"
            :enableAnnotationToolbar="false"
            :enableFormDesignerToolbar="true"
            :enableHandwrittenSignature="true"
            isSignatureEditable="true"
        >
        </ejs-pdfviewer>
</template>

import {
    Navigation,
} from '@syncfusion/ej2-pdfviewer';
<script lang="ts">
.
.
.

methods: {
   // want to achieve something like this
   goToNextPage() {
      Navigation.goToNextPage();
   }
}

</script>

只是我需要在 Injected 模块上调用一些方法。谢谢你的帮助。代码很简单,但思路很清楚。

4

0 回答 0