mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-04-24 15:01:22 +08:00
chore: some docs refine & radio select prop change
This commit is contained in:
parent
c689c1e874
commit
668d91b422
@ -39,6 +39,7 @@ item-header-click
|
||||
|header|`()`||
|
||||
|
||||
## Event
|
||||
### Collapse Event
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|expanded-names-change|`(expandedNames: Array<string>)`||
|
||||
|
@ -39,6 +39,7 @@ item-header-click
|
||||
|header|`()`||
|
||||
|
||||
## Event
|
||||
### Collapse Event
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|expanded-names-change|`(expandedNames: Array<string>)`||
|
||||
|
@ -71,11 +71,11 @@ format
|
||||
### Date, DateTime Type Events
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|change|`(currentValue: number \| null)`||
|
||||
|blur|`(currentValue: number \| null)`||
|
||||
|change|`(value: number \| null)`||
|
||||
|blur|`()`||
|
||||
|
||||
### DateRange, DateTimeRange Type Events
|
||||
|Name|Parameters|Description|
|
||||
|-|-|-|
|
||||
|change|`(currentValue: [number, number] \| null)`||
|
||||
|blur|`(currentValue: [number, number] \| null)`||
|
||||
|change|`(value: [number, number] \| null)`||
|
||||
|blur|`()`||
|
||||
|
@ -72,11 +72,11 @@ format
|
||||
### Date, DateTime 类型的 Events
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|change|`(currentValue: number \| null)`||
|
||||
|blur|`(currentValue: number \| null)`||
|
||||
|change|`(value: number \| null)`||
|
||||
|blur|`()`||
|
||||
|
||||
### DateRange, DateTimeRange 类型的 Events
|
||||
|名称|参数|说明|
|
||||
|-|-|-|
|
||||
|change|`(currentValue: [number, number] \| null)`||
|
||||
|blur|`(currentValue: [number, number] \| null)`||
|
||||
|change|`(value: [number, number] \| null)`||
|
||||
|blur|`()`||
|
||||
|
@ -23,6 +23,7 @@ size
|
||||
### Radio Props
|
||||
|Name|Type|Default|Description|
|
||||
|-|-|-|-|
|
||||
|theme|`'light' \| 'dark'`|`null`||
|
||||
|name|`string`|`undefined`|The name attribute of the radio element. If not set, name of `radio-group` will be used.|
|
||||
|checked-value|`string \| number \| boolean`|`null`||
|
||||
|value|`string \| number \| boolean`|`null`||
|
||||
@ -39,6 +40,7 @@ size
|
||||
### Radio Group Props
|
||||
|Name|Type|Default|Description|
|
||||
|-|-|-|-|
|
||||
|theme|`'light' \| 'dark'`|`null`||
|
||||
|name|`string`|`null`|The name attribute of the radio elements inside the group.|
|
||||
|size|`'small' \| 'medium' \| 'large'`|`small`||
|
||||
|value|`string \| number \| boolean`|`null`||
|
||||
|
@ -23,6 +23,7 @@ size
|
||||
### Radio Props
|
||||
|名称|类型|默认值|说明|
|
||||
|-|-|-|-|
|
||||
|theme|`'light' \| 'dark'`|`null`||
|
||||
|name|`string`|`undefined`|单选 radio 元素的 name 属性。如果没有设定会使用 `radio-group` 的 `name`|
|
||||
|checked-value|`string \| number \| boolean`|`null`||
|
||||
|value|`string \| number \| boolean`|`null`||
|
||||
@ -40,6 +41,7 @@ size
|
||||
### Radio Group Props
|
||||
|名称|类型|默认值|说明|
|
||||
|-|-|-|-|
|
||||
|theme|`'light' \| 'dark'`|`null`||
|
||||
|name|`string`|`null`|选项组内部 radio 元素的 name 属性|
|
||||
|size|`'small' \| 'medium' \| 'large'`|`small`||
|
||||
|value|`string \| number \| boolean`|`null`||
|
||||
|
@ -38,7 +38,7 @@ action
|
||||
|filterable|`boolean`|`false`|Whether it can filter options.|
|
||||
|filter|`(pattern: string, option: Object) => boolean`|A basic string based search method.||
|
||||
|tag|`boolean`|`false`|Whether it can create new option, should be used with `filterable`.|
|
||||
|create-option|`(label: string) => SelectOption`|`label => ({ label, value: label })`|How to create a option when you input a string to create a option. Note that `filter` will be applied to the option too. And make sure the value of the created option is not the same as any other option.|
|
||||
|on-create|`(label: string) => SelectOption`|`label => ({ label, value: label })`|How to create a option when you input a string to create a option. Note that `filter` will be applied to the created option too. And make sure the value of the created option is not the same as any other option.|
|
||||
|
||||
## API
|
||||
### SelectOption Type
|
||||
|
@ -25,6 +25,7 @@ action
|
||||
## Props
|
||||
|名称|类型|默认值|说明|
|
||||
|-|-|-|-|
|
||||
|theme|`'light' \| 'dark'`|`null`||
|
||||
|loading|`boolean`|`false`||
|
||||
|clearable|`boolean`|`false`||
|
||||
|value|`Array \| string \| number`|`false`||
|
||||
@ -37,7 +38,7 @@ action
|
||||
|filterable|`boolean`|`false`|是否可以过滤|
|
||||
|filter|`(pattern: string, option: Object) => boolean`|一个简单的字符串搜索算法||
|
||||
|tag|`boolean`|`false`|是否可以创建新的选项,需要和 `filterable` 一起使用|
|
||||
|create-option|`(label: string) => SelectOption`|`label => ({ label, value: label })`|在输入内容时如何创建一个选项。注意 `filter` 对这个选项同样会生效。同时确保这个选项和其他选项的 `value` 不要有重复|
|
||||
|on-create|`(label: string) => SelectOption`|`label => ({ label, value: label })`|在输入内容时如何创建一个选项。注意 `filter` 对这个生成的选项同样会生效。同时确保这个选项和其他选项的 `value` 不要有重复|
|
||||
|
||||
|
||||
## API
|
||||
|
@ -71,6 +71,20 @@ export default {
|
||||
},
|
||||
default: null
|
||||
}
|
||||
},
|
||||
computed: {
|
||||
syntheticTheme () {
|
||||
const theme = this.theme
|
||||
const NRadioGroup = this.NRadioGroup
|
||||
if (theme !== null) {
|
||||
return theme
|
||||
} else if (NRadioGroup && NRadioGroup.syntheticTheme) {
|
||||
return NRadioGroup.syntheticTheme
|
||||
} else {
|
||||
const NConfigProvider = this.NConfigProvider
|
||||
return (NConfigProvider && NConfigProvider.syntheticTheme) || null
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -202,7 +202,7 @@ export default {
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
createOption: {
|
||||
onCreate: {
|
||||
type: Function,
|
||||
default: label => ({
|
||||
label: label,
|
||||
@ -494,7 +494,7 @@ export default {
|
||||
this.beingCreatedOptions = []
|
||||
return
|
||||
}
|
||||
const optionBeingCreated = this.createOption(value)
|
||||
const optionBeingCreated = this.onCreate(value)
|
||||
if (
|
||||
this.adpatedOptions.some(
|
||||
option => option.value === optionBeingCreated.value
|
||||
|
Loading…
x
Reference in New Issue
Block a user