mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
feat(Search): add autocomplete prop (#9553)
This commit is contained in:
parent
6ff2b7ff0e
commit
0fc3361226
@ -69,6 +69,7 @@ export const fieldSharedProps = {
|
|||||||
maxlength: [Number, String],
|
maxlength: [Number, String],
|
||||||
inputAlign: String as PropType<FieldTextAlign>,
|
inputAlign: String as PropType<FieldTextAlign>,
|
||||||
placeholder: String,
|
placeholder: String,
|
||||||
|
autocomplete: String,
|
||||||
errorMessage: String,
|
errorMessage: String,
|
||||||
error: {
|
error: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
@ -108,7 +109,6 @@ const props = extend({}, cellProps, fieldSharedProps, {
|
|||||||
labelWidth: [Number, String],
|
labelWidth: [Number, String],
|
||||||
labelClass: unknownProp,
|
labelClass: unknownProp,
|
||||||
labelAlign: String as PropType<FieldTextAlign>,
|
labelAlign: String as PropType<FieldTextAlign>,
|
||||||
autocomplete: String,
|
|
||||||
showWordLimit: Boolean,
|
showWordLimit: Boolean,
|
||||||
errorMessageAlign: String as PropType<FieldTextAlign>,
|
errorMessageAlign: String as PropType<FieldTextAlign>,
|
||||||
type: {
|
type: {
|
||||||
|
@ -139,6 +139,7 @@ Use `action` slot to custom right button, `cancel` event will no longer be Emitt
|
|||||||
| input-align | Text align of field, can be set to `center` `right` | _string_ | `left` |
|
| input-align | Text align of field, can be set to `center` `right` | _string_ | `left` |
|
||||||
| left-icon | Left icon name | _string_ | `search` |
|
| left-icon | Left icon name | _string_ | `search` |
|
||||||
| right-icon | Right icon name | _string_ | - |
|
| right-icon | Right icon name | _string_ | - |
|
||||||
|
| autocomplete `v3.2.3` | [autocomplete](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) attribute of native input element | _string_ | - |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -151,6 +151,7 @@ export default {
|
|||||||
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | _string_ | `left` |
|
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | _string_ | `left` |
|
||||||
| left-icon | 输入框左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | `search` |
|
| left-icon | 输入框左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | `search` |
|
||||||
| right-icon | 输入框右侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - |
|
| right-icon | 输入框右侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - |
|
||||||
|
| autocomplete `v3.2.3` | input 标签原生的[自动完成属性](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
|
||||||
|
|
||||||
### Events
|
### Events
|
||||||
|
|
||||||
|
@ -150,3 +150,14 @@ test('should render id prop correctly', async () => {
|
|||||||
expect(wrapper.find('input').attributes('id')).toEqual('my-id');
|
expect(wrapper.find('input').attributes('id')).toEqual('my-id');
|
||||||
expect(wrapper.find('label').attributes('for')).toEqual('my-id');
|
expect(wrapper.find('label').attributes('for')).toEqual('my-id');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('should allow to set autocomplete attribute', () => {
|
||||||
|
const wrapper = mount(Search, {
|
||||||
|
props: {
|
||||||
|
autocomplete: 'on',
|
||||||
|
},
|
||||||
|
});
|
||||||
|
expect(wrapper.find('input').element.getAttribute('autocomplete')).toEqual(
|
||||||
|
'on'
|
||||||
|
);
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user