我正尝试在字符串中添加URL链接,但由于某种原因我无法显示它。是否可以将锚链接添加到警报?我正在使用antd显示警报。
class Settings extends PureComponent {
state = {
inValid:
"This is a message because you haven't verified your email. If you haven't so, please click here to Verify Email`<a href=\"http://bing.com\">Bing</a>.`"
};
render() {
const { inValid } = this.state;
return (
<AppLayout>
<Container>
<Row>
<Alert
message="Verify Email"
description={inValid}
type="warning"
showIcon
/>
<br />
<SettingsTabs />
</Row>
</Container>
</AppLayout>
);
}
}
答案 0 :(得分:2)
根据documentation,description
属性接受string
或ReactNode
。因此,您可以尝试定义一个ReactNode
而不是一个包含string
组件的Link
,例如:
state = {
inValid: (
<div>This is a message because you haven't verified your email. If you haven't so, please click here to Verify Email <Link href="http://bing.com">Bing</Link>.</div>
)
};