mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-23 23:18:36 +08:00
e7aa014c31
* docs: init * chore: all types * docs: faq * chore: fix lint
52 lines
1000 B
TypeScript
52 lines
1000 B
TypeScript
import React from 'react';
|
|
import { Mentions, Space } from 'antd';
|
|
import type { GetProp, MentionProps } from 'antd';
|
|
|
|
type MentionsOptionProps = GetProp<MentionProps, 'options'>[number];
|
|
|
|
const onChange = (value: string) => {
|
|
console.log('Change:', value);
|
|
};
|
|
|
|
const onSelect = (option: MentionsOptionProps) => {
|
|
console.log('select', option);
|
|
};
|
|
|
|
const App: React.FC = () => {
|
|
const options = [
|
|
{
|
|
value: 'afc163',
|
|
label: 'afc163',
|
|
},
|
|
{
|
|
value: 'zombieJ',
|
|
label: 'zombieJ',
|
|
},
|
|
{
|
|
value: 'yesmeck',
|
|
label: 'yesmeck',
|
|
},
|
|
];
|
|
|
|
return (
|
|
<Space direction="vertical">
|
|
<Mentions
|
|
onChange={onChange}
|
|
onSelect={onSelect}
|
|
defaultValue="@afc163"
|
|
status="error"
|
|
options={options}
|
|
/>
|
|
<Mentions
|
|
onChange={onChange}
|
|
onSelect={onSelect}
|
|
defaultValue="@afc163"
|
|
status="warning"
|
|
options={options}
|
|
/>
|
|
</Space>
|
|
);
|
|
};
|
|
|
|
export default App;
|