mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2024-12-21 04:50:14 +08:00
feat(input): add input-props
prop (#204)
* fix: add some lost form props * chore: remove ts expect error * feat: add `input-props` * chore: update docs * revert: clearable demo * chore: typo * chore: remove blank line * fix: docs & props * docs: update * chore: changelog
This commit is contained in:
parent
7ce6b92e88
commit
fa0a51ee14
@ -2,6 +2,8 @@
|
||||
|
||||
## Pending
|
||||
|
||||
- `n-input` add standard property `input-props`
|
||||
|
||||
### Feats
|
||||
|
||||
- `n-carousel` supports touch operation, closes [#271](https://github.com/TuSimple/naive-ui/issues/271).
|
||||
|
@ -2,6 +2,8 @@
|
||||
|
||||
## Pending
|
||||
|
||||
- `n-input` 添加原生属性 `input-props`
|
||||
|
||||
### Feats
|
||||
|
||||
- `n-carousel` 支持触控操作,关闭 [#271](https://github.com/TuSimple/naive-ui/issues/271)
|
||||
|
@ -30,6 +30,7 @@ count
|
||||
| clearable | `boolean` | `false` | |
|
||||
| default-value | `string \| [string, string] \| null` | `null` | |
|
||||
| disabled | `boolean` | `false` | |
|
||||
| input-props | `object` | `undefined` | The props of the input element inside the component. It doesn't work with `pair` input. |
|
||||
| show-password-toggle | `boolean` | `false` | Controls the display and hiding of passwords |
|
||||
| maxlength | `number` | `undefined` | |
|
||||
| minlength | `number` | `undefined` | |
|
||||
|
@ -30,6 +30,7 @@ count
|
||||
| clearable | `boolean` | `false` | |
|
||||
| default-value | `string \| [string, string] \| null` | `null` | |
|
||||
| disabled | `boolean` | `false` | |
|
||||
| input-props | `object` | `undefined` | 组件中 input 元素的属性,对 `pair` 类型不生效 |
|
||||
| show-password-toggle | `boolean` | `false` | 控制密码的显示隐藏 |
|
||||
| maxlength | `number` | `undefined` | |
|
||||
| minlength | `number` | `undefined` | |
|
||||
|
@ -13,7 +13,9 @@ import {
|
||||
watch,
|
||||
watchEffect,
|
||||
WatchStopHandle,
|
||||
provide
|
||||
provide,
|
||||
InputHTMLAttributes,
|
||||
TextareaHTMLAttributes
|
||||
} from 'vue'
|
||||
import { useMergedState } from 'vooks'
|
||||
import { getPadding } from 'seemly'
|
||||
@ -82,6 +84,8 @@ const inputProps = {
|
||||
default: true
|
||||
},
|
||||
autofocus: Boolean,
|
||||
inputProps: Object as PropType<TextareaHTMLAttributes | InputHTMLAttributes>,
|
||||
|
||||
resizable: {
|
||||
type: Boolean,
|
||||
default: true
|
||||
@ -829,6 +833,7 @@ export default defineComponent({
|
||||
{this.type === 'textarea' ? (
|
||||
<div class={`${mergedClsPrefix}-input__textarea`}>
|
||||
<textarea
|
||||
{...this.inputProps}
|
||||
ref="textareaElRef"
|
||||
class={`${mergedClsPrefix}-input__textarea-el`}
|
||||
autofocus={this.autofocus}
|
||||
@ -873,6 +878,7 @@ export default defineComponent({
|
||||
) : (
|
||||
<div class={`${mergedClsPrefix}-input__input`}>
|
||||
<input
|
||||
{...this.inputProps}
|
||||
ref="inputElRef"
|
||||
type={
|
||||
this.type === 'password' &&
|
||||
|
Loading…
Reference in New Issue
Block a user