使用旋转图标显示蚂蚁设计按钮

发布于 2025-01-26 06:08:39 字数 2974 浏览 4 评论 0原文

在我的NextJS项目中,我使用蚂蚁设计。但是,每当我使用按钮组件时,它都会在其附近显示一个旋转图标。我可以使用显示:无;等手动删除旋转图标,但是我想知道是什么原因造成的。

这是我的 globals.css

/* Import ant design styles */
@import '~antd/dist/antd.css';


:root {
  --pink: #ea4c89;
  --blue: #40a9ff;
  --black: rgb(26, 32, 44);
  --text: #535c68;
}

html,
body {
  padding: 0;
  margin: 0;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  scroll-behavior: smooth;
  /* font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", 
    Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; */

  /* background-color: wheat; */
}

a {
  color: inherit;
  text-decoration: none;
}

* {
  box-sizing: border-box;
}


_app.tsx

import '../styles/tailwindImports.css'
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { ChakraProvider } from '@chakra-ui/react'


function MyApp({ Component, pageProps }: AppProps) {
  return (
    <ChakraProvider>
      <Component {...pageProps} />
    </ChakraProvider>
  )
}

export default MyApp

在我的 home.tsx 中,我使用了按钮组件。

import type { NextPage } from 'next'
import Head from 'next/head'
import { Button } from 'antd'


const Home: NextPage = () => {
  return (
    <section>
      <Head>
        <title>title...</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.png" />
      </Head>

      <main>
        <Button>Feedback</Button>
      </main>
    </section>
  )
}

export default Home

基本上是如何渲染按钮(使用旋转图标)”
这是渲染的代码(来自浏览器控制台),

<button type="button" class="ant-btn ant-btn-default popover" ant-click-animating-without-extra-node="false"><span class="ant-btn-loading-icon"><span role="img" aria-label="loading" class="anticon anticon-loading anticon-spin ant-btn-loading-icon-motion-leave ant-btn-loading-icon-motion"><svg viewBox="0 0 1024 1024" focusable="false" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span></span><span>Feedback</span></button>

这可能是问题的原因?我还尝试将loading = {false} prop添加到按钮,但无济于事。

In my nextjs project, i use ant-design. However, whenever i use the Button component, it displays with a spinning icon near it. I can manually remove the spinning icon using display: none; etc but i would like to know what caused it in the first place.

Here's my globals.css

/* Import ant design styles */
@import '~antd/dist/antd.css';


:root {
  --pink: #ea4c89;
  --blue: #40a9ff;
  --black: rgb(26, 32, 44);
  --text: #535c68;
}

html,
body {
  padding: 0;
  margin: 0;
  color: var(--text);
  font-family: 'Inter', sans-serif;
  scroll-behavior: smooth;
  /* font-family: 'Inter', 'Montserrat', -apple-system, BlinkMacSystemFont, "Segoe UI", 
    Roboto, Oxygen, Ubuntu, Cantarell, "Fira Sans", "Droid Sans", "Helvetica Neue", sans-serif; */

  /* background-color: wheat; */
}

a {
  color: inherit;
  text-decoration: none;
}

* {
  box-sizing: border-box;
}

_app.tsx

import '../styles/tailwindImports.css'
import '../styles/globals.css'
import type { AppProps } from 'next/app'
import { ChakraProvider } from '@chakra-ui/react'


function MyApp({ Component, pageProps }: AppProps) {
  return (
    <ChakraProvider>
      <Component {...pageProps} />
    </ChakraProvider>
  )
}

export default MyApp

In my Home.tsx, i used the Button component.

import type { NextPage } from 'next'
import Head from 'next/head'
import { Button } from 'antd'


const Home: NextPage = () => {
  return (
    <section>
      <Head>
        <title>title...</title>
        <meta name="description" content="Generated by create next app" />
        <link rel="icon" href="/favicon.png" />
      </Head>

      <main>
        <Button>Feedback</Button>
      </main>
    </section>
  )
}

export default Home

This is basically how the button is rendered(with a spinning icon)

Here's the rendered code(from the browser console)

<button type="button" class="ant-btn ant-btn-default popover" ant-click-animating-without-extra-node="false"><span class="ant-btn-loading-icon"><span role="img" aria-label="loading" class="anticon anticon-loading anticon-spin ant-btn-loading-icon-motion-leave ant-btn-loading-icon-motion"><svg viewBox="0 0 1024 1024" focusable="false" data-icon="loading" width="1em" height="1em" fill="currentColor" aria-hidden="true"><path d="M988 548c-19.9 0-36-16.1-36-36 0-59.4-11.6-117-34.6-171.3a440.45 440.45 0 00-94.3-139.9 437.71 437.71 0 00-139.9-94.3C629 83.6 571.4 72 512 72c-19.9 0-36-16.1-36-36s16.1-36 36-36c69.1 0 136.2 13.5 199.3 40.3C772.3 66 827 103 874 150c47 47 83.9 101.8 109.7 162.7 26.7 63.1 40.2 130.2 40.2 199.3.1 19.9-16 36-35.9 36z"></path></svg></span></span><span>Feedback</span></button>

What could be the cause of the problem ?! I also tried adding the loading={false} prop to the Button but to no avail.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文