请告诉我如何编写'printed'的nuxt插件

问题描述 投票:0回答:1

在开发过程中,我们实现了要使用Printed打印的页面。

创建插件/ printd.ts

import Vue from "vue";
import { Printd } from "printd";

Vue.use(Printd);

[nuxt.conifg.ts的'插件'部分。

plugins: [
... ,
{ src: "~/plugins/printd", ssr: false }]

但是错误显示在下面

10:9 No overload matches this call.
  Overload 1 of 2, '(plugin: PluginObject<unknown> | PluginFunction<unknown>, options?: unknown): VueConstructor<Vue>', gave the following error.
    Argument of type 'typeof Printd' is not assignable to parameter of type 'PluginObject<unknown> | PluginFunction<unknown>'.
      Property 'install' is missing in type 'typeof Printd' but required in type 'PluginObject<unknown>'.
  Overload 2 of 2, '(plugin: PluginObject<any> | PluginFunction<any>, ...options: any[]): VueConstructor<Vue>', gave the following error.
    Argument of type 'typeof Printd' is not assignable to parameter of type 'PluginObject<any> | PluginFunction<any>'.
      Property 'install' is missing in type 'typeof Printd' but required in type 'PluginObject<any>'.
     8 | 
     9 | 
  > 10 | Vue.use(Printd);
       |         ^
    11 | 

帮帮我!

plugins nuxt.js
1个回答
0
投票

我尚未成功安装此插件,您的评论有用吗? ,那么您应该能够在您的应用程序中访问this.d吗?

© www.soinside.com 2019 - 2024. All rights reserved.