使用旋转图标显示蚂蚁设计按钮
在我的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
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 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论