使用安特包(v3),我希望有一个固定宽度的按钮,在需要时将其文本和换行符包装起来,以便文本适合按钮内部,边框正确地出现在文本周围。
下面是我目前尝试过的:科德芬。我注意到使用空格:正常工作,但不与antd。
const { Button } = antd;
ReactDOM.render(
<>
<div style={{width:"100px"}}>
<Button block type="primary" ghost style={{whiteSpace: "normal"}}>Wrap around text</Button>
</div>
<button style={{width: '100px', whiteSpace: 'normal'}} type='primary'>Wrap around text</button>
</>,
mountNode,
);发布于 2020-08-13 11:59:46
类“ant”具有固定高度属性,您需要自动重写它并使其工作。
<Button block type="primary" ghost style={{whiteSpace: "normal",height:'auto',marginBottom:'10px'}}>Wrap around text</Button>https://stackoverflow.com/questions/63393675
复制相似问题