在 Ant Design 中,可以通过使用多个 addonBefore
属性来实现多个 addonBefore 的效果。
以下是一个示例代码:
import { Input } from 'antd';
const App = () => {
return (
Before Text}
addonBefore="Addon 1"
addonBefore="Addon 2"
/>
);
};
export default App;
在上面的示例中,我们在 Input
组件中使用了多个 addonBefore
属性,每个 addonBefore
属性都会显示在输入框的前面。你可以根据自己的需求添加或删除 addonBefore
属性,并在每个属性中传入你想要显示的内容。
注意:在 Ant Design 中,addonBefore
属性只能接受一个组件或字符串作为参数,所以如果你想要显示多个组件,需要将它们包裹在一个容器组件(如 span
)中。
希望这个解决方法能够帮助到你!
下一篇:antd: 嵌套选择器/下拉菜单