2019-05-17 12:05:03 +08:00
|
|
|
---
|
|
|
|
order: 4
|
|
|
|
title:
|
|
|
|
zh-CN: 无效或只读
|
|
|
|
en-US: disabled or readOnly
|
|
|
|
---
|
|
|
|
|
|
|
|
## zh-CN
|
|
|
|
|
|
|
|
通过 `disabled` 属性设置是否生效。通过 `readOnly` 属性设置是否只读。
|
|
|
|
|
|
|
|
## en-US
|
|
|
|
|
|
|
|
Configurate `disabled` and `readOnly`.
|
|
|
|
|
2022-05-19 09:46:26 +08:00
|
|
|
```tsx
|
2022-05-23 14:37:16 +08:00
|
|
|
import React from 'react';
|
2022-11-23 21:00:24 +08:00
|
|
|
import { Mentions } from 'antd';
|
2019-05-17 12:05:03 +08:00
|
|
|
|
2022-11-23 21:00:24 +08:00
|
|
|
const options = ['afc163', 'zombiej', 'yesmeck'].map(value => ({
|
|
|
|
value,
|
|
|
|
key: value,
|
|
|
|
label: value,
|
|
|
|
}));
|
2022-05-19 09:46:26 +08:00
|
|
|
|
|
|
|
const App: React.FC = () => (
|
|
|
|
<>
|
|
|
|
<div style={{ marginBottom: 10 }}>
|
2022-11-23 21:00:24 +08:00
|
|
|
<Mentions
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
placeholder="this is disabled Mentions"
|
|
|
|
disabled
|
|
|
|
options={options}
|
|
|
|
/>
|
2022-05-19 09:46:26 +08:00
|
|
|
</div>
|
2022-11-23 21:00:24 +08:00
|
|
|
<Mentions
|
|
|
|
style={{ width: '100%' }}
|
|
|
|
placeholder="this is readOnly Mentions"
|
|
|
|
readOnly
|
|
|
|
options={options}
|
|
|
|
/>
|
2022-05-19 09:46:26 +08:00
|
|
|
</>
|
|
|
|
);
|
2019-05-17 12:05:03 +08:00
|
|
|
|
2022-04-15 16:20:56 +08:00
|
|
|
export default App;
|
2019-05-17 12:05:03 +08:00
|
|
|
```
|