如何覆盖 antd 抽屉的过渡效果?

huangapple go评论75阅读模式
英文:

How to override the transition of drawer from antd?

问题

我有 2 个 antd 抽屉 - 第一个调用第二个,当我打开第一个时一切都正常,但当我打开第二个时 - 第一个向右转移 180px - transformX(180px)。

我看到这是 GitHub 上的一个已知问题 - https://github.com/ant-design/ant-design/issues/18781,但我尝试了其中一个人写的解决方案,但没有奏效。

英文:

I have 2 drawers from antd - first calls the second, when I open the first everything is okay, but when I open the second - the first transitions 180px to the right

  • transformX(180px)

I've seen that this is an open issue on github - https://github.com/ant-design/ant-design/issues/18781

but I've tried the solution one of them wrote and it didn't work.

答案1

得分: 3

通过 styled-components,有一种方法可以进行覆盖 -

import { Drawer } from "antd";
const StyledDrawer = styled(Drawer)``
  .ant-drawer-content-wrapper {
    transform: translateX(0px) !important;
  }
```;


<details>
<summary>英文:</summary>

Through styled-components there&#39;s a way to override it - 



import { Drawer } from "antd";
const StyledDrawer = styled(Drawer)
.ant-drawer-content-wrapper {
transform: translateX(0px) !important;
}
;


</details>



huangapple
  • 本文由 发表于 2023年2月26日 22:55:47
  • 转载请务必保留本文链接:https://go.coder-hub.com/75572815.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定