mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-04-12 14:40:47 +08:00
feat(select): add show-on-focus
prop, closes #4191
This commit is contained in:
parent
bcf0c2374d
commit
e104d02d02
@ -7,6 +7,7 @@
|
||||
- `n-badge` adds `offset` prop, closes [#4149](https://github.com/tusen-ai/naive-ui/issues/4149).
|
||||
- `n-card` adds `tag` prop
|
||||
- `n-pagination` adds `select-props` prop, closes [#4199](https://github.com/tusen-ai/naive-ui/issues/4199).
|
||||
- `n-select` adds `show-on-focus` prop, closes [#4191](https://github.com/tusen-ai/naive-ui/issues/4191).
|
||||
|
||||
### Fixes
|
||||
|
||||
|
@ -6,7 +6,8 @@
|
||||
|
||||
- `n-badge` 新增 `offset` 属性,关闭 [#4149](https://github.com/tusen-ai/naive-ui/issues/4149)
|
||||
- `n-card` 新增 `tag` 属性
|
||||
- `n-pagination` 新增 `select-props` 属性,关闭[#4199](https://github.com/tusen-ai/naive-ui/issues/4199)
|
||||
- `n-pagination` 新增 `select-props` 属性,关闭 [#4199](https://github.com/tusen-ai/naive-ui/issues/4199)
|
||||
- `n-select` 新增 `show-on-focus` 属性,关闭 [#4191](https://github.com/tusen-ai/naive-ui/issues/4191)
|
||||
|
||||
### Fixes
|
||||
|
||||
|
@ -65,6 +65,7 @@ custom-field.vue
|
||||
| show | `boolean` | `undefined` | Whether to show/open the option menu. | |
|
||||
| show-arrow | `boolean` | `true` | Whether to show the dropdown arrow. | |
|
||||
| show-checkmark | `boolean` | `true` | Whether to show checkmark in multiple select mode. | 2.33.4 |
|
||||
| show-on-focus | `boolean` | `false` | Whether to show menu on focus. | NEXT_VERSION |
|
||||
| size | `'tiny' \| 'small' \| 'medium' \| 'large'` | `'medium'` | Size of the select input. | |
|
||||
| status | `'success' \| 'warning' \| 'error'` | `undefined` | Validation status. | 2.27.0 |
|
||||
| tag | `boolean` | `false` | Whether users can create new options. This should be used with `filterable`. | |
|
||||
|
@ -75,6 +75,7 @@ create-debug.vue
|
||||
| show | `boolean` | `undefined` | 是否展示菜单 | |
|
||||
| show-arrow | `boolean` | `true` | 是否展示箭头 | |
|
||||
| show-checkmark | `boolean` | `true` | 多选情况下是否展示对勾 | 2.33.4 |
|
||||
| show-on-focus | `boolean` | `false` | 聚焦时是否展示菜单 | NEXT_VERSION |
|
||||
| size | `'tiny' \| 'small' \| 'medium' \| 'large'` | `'medium'` | 组件尺寸 | |
|
||||
| status | `'success' \| 'warning' \| 'error'` | `undefined` | 验证状态 | 2.27.0 |
|
||||
| tag | `boolean` | `false` | 是否可以创建新的选项,需要和 `filterable` 一起使用 | |
|
||||
|
@ -164,6 +164,7 @@ export const selectProps = {
|
||||
inputProps: Object as PropType<InputHTMLAttributes>,
|
||||
nodeProps: Function as PropType<NodeProps>,
|
||||
ignoreComposition: { type: Boolean, default: true },
|
||||
showOnFocus: Boolean,
|
||||
// for jsx
|
||||
onUpdateValue: [Function, Array] as PropType<
|
||||
MaybeArray<OnUpdateValue> | undefined
|
||||
@ -420,9 +421,12 @@ export default defineComponent({
|
||||
if (onClear) call(onClear)
|
||||
}
|
||||
function doFocus (e: FocusEvent): void {
|
||||
const { onFocus } = props
|
||||
const { onFocus, showOnFocus } = props
|
||||
const { nTriggerFormFocus } = formItem
|
||||
if (onFocus) call(onFocus, e)
|
||||
if (showOnFocus) {
|
||||
openMenu()
|
||||
}
|
||||
nTriggerFormFocus()
|
||||
}
|
||||
function doSearch (value: string): void {
|
||||
|
Loading…
x
Reference in New Issue
Block a user