mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-03-07 13:48:31 +08:00
docs(mention,radio,rate): better en (#1325)
* Docs - NMention * Docs NRadio (English) * Docs NRadio (English) * Docs final edits Co-authored-by: 07akioni <07akioni2@gmail.com>
This commit is contained in:
parent
938602faa7
commit
d2c7e64fc5
@ -1,6 +1,6 @@
|
||||
# Load Remote Options
|
||||
|
||||
Load options async.
|
||||
Load options asynchronously.
|
||||
|
||||
```html
|
||||
<n-mention
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Basic Usage
|
||||
|
||||
If `label` is a callback function, input matching will be performed according to `value`.
|
||||
If `label` is a render function, the `value` property will be used for matching.
|
||||
|
||||
```html
|
||||
<n-mention :options="options" default-value="@" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Custom Trigger Prefix
|
||||
|
||||
Use `prefix` to set trigger char.
|
||||
Use `prefix` to set the trigger character(s).
|
||||
|
||||
```html
|
||||
<n-mention :options="options" :prefix="['@', '#']" @search="handleSearch" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Mention
|
||||
|
||||
A year ago, product manager ask me if I could implement the feature. At that time, I told them to use multiple select as a workaround.
|
||||
A year ago, my product manager asked me if I could implement this feature. Back then, I recommended just using multiple selects as a workaround.
|
||||
|
||||
## Demos
|
||||
|
||||
@ -19,26 +19,26 @@ manual-trigger
|
||||
|
||||
### Mention Props
|
||||
|
||||
Mention is provided after `v2.2.0`.
|
||||
Mention requires `v2.2.0` and above.
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| autosize | `boolean \| { maxRows?: number, minRows?: number }` | `false` | Autosize. |
|
||||
| options | `MentionOption[]` | `[]` | Mention Options list. |
|
||||
| options | `MentionOption[]` | `[]` | Mention options list. |
|
||||
| type | `'text' \| 'textarea'` | `'text'` | Input type. |
|
||||
| separator | `string` | `' '` | Char to split mentions whose length must be 1. |
|
||||
| bordered | `boolean` | `true` | Whether to display the border of the input box. |
|
||||
| disabled | `boolean` | `false` | Whether to set the input box to be disabled. |
|
||||
| value | `string \| null` | `undefined` | Input value. |
|
||||
| default-value | `string` | `''` | Input default value. |
|
||||
| loading | `boolean` | `false` | Whether the selection panel of mentions shows the loading status. |
|
||||
| prefix | `string \| string[]` | `'@'` | Prefix char to trigger mentions whose length must be 1. |
|
||||
| placeholder | `string` | `''` | Input placeholder. |
|
||||
| render-label | `undefined \| (option: MentionOption) => VNodeChild` | `undefined` | Render function of all the options' label. |
|
||||
| separator | `string` | `' '` | Character to split mentions. The string length must be exactly 1. |
|
||||
| bordered | `boolean` | `true` | Whether to display the border of the input element. |
|
||||
| disabled | `boolean` | `false` | Whether to disable the input element. |
|
||||
| value | `string \| null` | `undefined` | Manually set input value. |
|
||||
| default-value | `string` | `''` | Default value when the value is not manually set. |
|
||||
| loading | `boolean` | `false` | Whether the selection panel of mentions is in a loading state. |
|
||||
| prefix | `string \| string[]` | `'@'` | Prefix character(s) to trigger mentions. The string length(s) must be exactly 1. |
|
||||
| placeholder | `string` | `''` | Placeholder. |
|
||||
| render-label | `undefined \| (option: MentionOption) => VNodeChild` | `undefined` | Options' labels render function. |
|
||||
| size | `'small' \| 'medium' \| 'large'` | `'medium'` | Input size. |
|
||||
| on-update:value | `(value: string) => void` | `undefined` | Triggered when the input box value is updated. |
|
||||
| on-select | `(option: MentionOption, prefix: string) => void` | `undefined` | Triggered when the input box is selected. |
|
||||
| on-focus | `(e: FocusEvent) => void` | `undefined` | Triggered when the input box gets focus. |
|
||||
| on-focus | `(e: FocusEvent) => void` | `undefined` | Triggered when the input box is focussed on. |
|
||||
| on-search | `(pattern: string, prefix: string) => void` | `undefined` | Triggered when searching in the input box. |
|
||||
| on-blur | `(e: FocusEvent) => void` | `undefined` | Triggered when the input box loses focus. |
|
||||
|
||||
@ -46,18 +46,18 @@ Mention is provided after `v2.2.0`.
|
||||
|
||||
| Name | Type | Description |
|
||||
| --- | --- | --- |
|
||||
| class | `string` | Option class name. |
|
||||
| disabled | `boolean` | Option disabled status. |
|
||||
| class | `string` | Option class property. |
|
||||
| disabled | `boolean` | Option disabled state. |
|
||||
| label | `string \| (option: MentionOption) => VNodeChild` | Option label. |
|
||||
| render | `(option: MentionOption) => VNodeChild` | Support custom options via `render` rendering function. |
|
||||
| style | `string` | Option style. |
|
||||
| value | `string` | Should be unique. |
|
||||
| style | `string` | Option style property. |
|
||||
| value | `string` | Option value. Must be unique. |
|
||||
|
||||
### Mention Methods
|
||||
|
||||
| Name | Type | Description |
|
||||
| ----- | ------------ | ----------------------------- |
|
||||
| focus | `() => void` | Manually focus the component. |
|
||||
| focus | `() => void` | Manually focus on the component. |
|
||||
| blur | `() => void` | Manually blur the component. |
|
||||
|
||||
### Mention Slots
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Manually Trigger Focus and Blur
|
||||
|
||||
Maybe you want to trigger `focus` and `blur` manually.
|
||||
You may want to trigger `focus` and `blur` manually?
|
||||
|
||||
```html
|
||||
<n-space>
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Render Label
|
||||
|
||||
If `option.label` is not a string, `option.value` will be used to match option by default.
|
||||
If the `option.label` property is not a string, the `option.value` property will be used for matching by default.
|
||||
|
||||
```html
|
||||
<n-mention :options="options" :render-label="renderLabel" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Textarea
|
||||
|
||||
Set `type` to `'textarea'`.
|
||||
The input `type` can be set to `'textarea'`.
|
||||
|
||||
```html
|
||||
<n-mention type="textarea" :options="options" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Button Group
|
||||
|
||||
Sometimes a radio button group looks more elegant.
|
||||
Sometimes a radio button group can look more elegant.
|
||||
|
||||
```html
|
||||
<n-space vertical>
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Group
|
||||
|
||||
A radio group look elegant.
|
||||
A radio group looks elegant.
|
||||
|
||||
```html
|
||||
<n-radio-group v-model:value="value" name="radiogroup">
|
||||
|
@ -2,7 +2,7 @@
|
||||
|
||||
<!--single-column-->
|
||||
|
||||
When I was young, I was fond of listening to the radio, such as FM 106.8 or FM 92.1.
|
||||
When I was young, I loved listening to the radio, such as FM 106.8 or FM 92.1.
|
||||
|
||||
## Demos
|
||||
|
||||
@ -19,20 +19,20 @@ size
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| checked | `boolean` | `undefined` | Checked status. |
|
||||
| default-checked | `boolean` | `false` | Default checked status. |
|
||||
| disabled | `boolean` | `false` | Disabled status. |
|
||||
| checked | `boolean` | `undefined` | Checked state. |
|
||||
| default-checked | `boolean` | `false` | Default checked state. |
|
||||
| disabled | `boolean` | `false` | Disabled state. |
|
||||
| name | `string` | `undefined` | The name attribute of the radio element. If not set, name of `radio-group` will be used. |
|
||||
| size | `'small' \| 'medium' \| 'large'` | `'medium'` | Size. |
|
||||
| value | `string` | `undefined` | Checked value. |
|
||||
| on-update:checked | `(check: boolean) => void` | `undefined` | Callback method triggered when a change occurs. |
|
||||
| on-update:checked | `(check: boolean) => void` | `undefined` | Callback method triggered when a selection change occurs. |
|
||||
|
||||
### RadioGroup Props
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| disabled | `boolean` | `false` | Disabled status. |
|
||||
| disabled | `boolean` | `false` | Disabled state. |
|
||||
| name | `string` | `undefined` | The name attribute of the radio elements inside the group. |
|
||||
| size | `'small' \| 'medium' \| 'large'` | `'medium'` | Size. |
|
||||
| value | `string \| null` | `null` | Checked value. |
|
||||
| on-update:value | `(value: string) => void` | `undefined` | Callback method triggered when a change occurs. |
|
||||
| on-update:value | `(value: string) => void` | `undefined` | Callback method triggered when a selection change occurs. |
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Size
|
||||
|
||||
Choose whatever you want.
|
||||
Choose the size you want.
|
||||
|
||||
```html
|
||||
<n-space vertical>
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Color
|
||||
|
||||
That's how disaster happens.
|
||||
This can end in disaster.
|
||||
|
||||
```html
|
||||
<n-rate color="#4fb233" />
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Icon
|
||||
|
||||
The content in default slot will be used as icon.
|
||||
The content of the default slot will be used as the icon.
|
||||
|
||||
```html
|
||||
<n-rate>
|
||||
|
@ -1,6 +1,6 @@
|
||||
# Rate
|
||||
|
||||
If you not very confident, be careful about changing star's color. That will be a disaster.
|
||||
Hint: If you are not very confident, think twice before changing the star's color. That can lead to a disaster.
|
||||
|
||||
## Demos
|
||||
|
||||
@ -19,17 +19,17 @@ readonly
|
||||
|
||||
| Name | Type | Default | Description |
|
||||
| --- | --- | --- | --- |
|
||||
| allow-half | `boolean` | `false` | Allow activated half of the icon. |
|
||||
| color | `string` | `undefined` | Icon color activated(support `#FFF`, `#FFFFFF`, `yellow`,`rgb(0, 0, 0)` formatted colors). |
|
||||
| count | `number` | `5` | Icon count. |
|
||||
| default-value | `number` | `0` | Value of activated icons by default. |
|
||||
| readonly | `boolean` | `false` | Read only. |
|
||||
| allow-half | `boolean` | `false` | Allow activating half of the icon. |
|
||||
| color | `string` | `undefined` | Activated icon color. This supports the formats: `#FFF`, `#FFFFFF`, `yellow`, `rgb(0, 0, 0)`. |
|
||||
| count | `number` | `5` | Number of icons (max rating). |
|
||||
| default-value | `number` | `0` | Default value of activated icons. |
|
||||
| readonly | `boolean` | `false` | Readonly state. |
|
||||
| size | `'small' \| 'medium' \| 'large' \| number` | `'medium'` | Icon size. |
|
||||
| value | `number` | `undefined` | Value of activated icons. |
|
||||
| on-update:value | `(value: number) => void` | `undefined` | Callback when update value. |
|
||||
| on-update:value | `(value: number) => void` | `undefined` | Callback when the value (rating) is changed. |
|
||||
|
||||
### Rate Slots
|
||||
|
||||
| Name | Parameters | Description |
|
||||
| ------- | ---------- | --------------------- |
|
||||
| default | `()` | The icon of the rate. |
|
||||
| default | `()` | The icon of the rating. |
|
||||
|
Loading…
Reference in New Issue
Block a user