mirror of
https://github.com/ant-design/ant-design.git
synced 2024-12-05 09:49:57 +08:00
37 lines
867 B
TypeScript
37 lines
867 B
TypeScript
|
import React from 'react';
|
||
|
import { Mentions, Space } from 'antd';
|
||
|
import type { OptionProps } from 'antd/es/mentions';
|
||
|
|
||
|
const { Option } = Mentions;
|
||
|
|
||
|
const onChange = (value: string) => {
|
||
|
console.log('Change:', value);
|
||
|
};
|
||
|
|
||
|
const onSelect = (option: OptionProps) => {
|
||
|
console.log('select', option);
|
||
|
};
|
||
|
|
||
|
const App: React.FC = () => {
|
||
|
const options = (
|
||
|
<>
|
||
|
<Option value="afc163">afc163</Option>
|
||
|
<Option value="zombieJ">zombieJ</Option>
|
||
|
<Option value="yesmeck">yesmeck</Option>
|
||
|
</>
|
||
|
);
|
||
|
|
||
|
return (
|
||
|
<Space direction="vertical">
|
||
|
<Mentions onChange={onChange} onSelect={onSelect} defaultValue="@afc163" status="error">
|
||
|
{options}
|
||
|
</Mentions>
|
||
|
<Mentions onChange={onChange} onSelect={onSelect} defaultValue="@afc163" status="warning">
|
||
|
{options}
|
||
|
</Mentions>
|
||
|
</Space>
|
||
|
);
|
||
|
};
|
||
|
|
||
|
export default App;
|