使用AniLink进行的盖茨比转换-不起作用

时间:2019-07-30 02:27:11

标签: gatsby

只需试用AniLink,但似乎该软件包存在一些问题。测试该链接似乎不起作用,并且似乎导入也引发了错误:

Could not find a declaration file for module 'gatsby-plugin-transition-link/AniLink'. '/Users/robert/Software/bDev/evu/node_modules/gatsby-plugin-transition-link/AniLink/index.js' implicitly has an 'any' type.
  Try `npm install @types/gatsby-plugin-transition-link` if it exists or add a new declaration (.d.ts) file containing `declare module 'gatsby-plugin-transition-link/AniLink';`ts(7016)

该组件是在布局组件中使用的banner.js文件。

我导入了AniLink:

import AniLink from 'gatsby-plugin-transition-link/AniLink';

并尝试使用它,但没有任何反应:

<AniLink fade to="allProducts">View Now</AniLink> // or to="/allProducts"

我的配置文件:

module.exports = {
  siteMetadata: {
    title: `EssentialVu`,
    description: `Some really sweet ecommerce site.`,
    author: `@gatsbyjs`,
  },

  plugins: [
    `gatsby-plugin-react-helmet`,
    {
      resolve: `gatsby-source-filesystem`,
      options: {
        name: `images`,
        path: `${__dirname}/src/images`,
      },
    },
    `gatsby-transformer-sharp`,
    `gatsby-plugin-stripe`,
    {
      resolve: `gatsby-source-stripe`,
      options: {
        objects: ["Sku"],
        secretKey: process.env.STRIPE_SECRET_KEY,
        downloadFiles: true,
      },
    },
    {
      resolve: "gatsby-plugin-transition-link",
      options: {
          layout: require.resolve(`./src/components/layout.js`)
        },
    }
    `gatsby-plugin-sharp`,
    {
      resolve: `gatsby-plugin-manifest`,
      options: {
        name: `gatsby-starter-default`,
        short_name: `starter`,
        start_url: `/`,
        background_color: `#663399`,
        theme_color: `#663399`,
        display: `minimal-ui`,
        icon: `src/images/gatsby-icon.png`, // This path is relative to the root of the site.
      },
    },
    // this (optional) plugin enables Progressive Web App + Offline functionality
    // To learn more, visit: https://gatsby.dev/offline
    // `gatsby-plugin-offline`,
  ],

}

我还安装了gsap:"gsap": "^2.1.3",

1 个答案:

答案 0 :(得分:0)

您尝试了吗?

npm install @types/gatsby-plugin-transition-link