mirror of
https://gitee.com/ant-design/ant-design.git
synced 2024-12-15 09:21:22 +08:00
8fd6ae54e9
* feat: fix support options * feat: update package
50 lines
940 B
TypeScript
50 lines
940 B
TypeScript
import React from 'react';
|
|
import { Mentions, Space } from 'antd';
|
|
import type { MentionsOptionProps } from 'antd/es/mentions';
|
|
|
|
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;
|