feat(Search): add autocomplete prop (#9553)

This commit is contained in:
neverland 2021-09-23 16:52:05 +08:00 committed by GitHub
parent 6ff2b7ff0e
commit 0fc3361226
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 1 deletions

View File

@ -69,6 +69,7 @@ export const fieldSharedProps = {
maxlength: [Number, String],
inputAlign: String as PropType<FieldTextAlign>,
placeholder: String,
autocomplete: String,
errorMessage: String,
error: {
type: Boolean,
@ -108,7 +109,6 @@ const props = extend({}, cellProps, fieldSharedProps, {
labelWidth: [Number, String],
labelClass: unknownProp,
labelAlign: String as PropType<FieldTextAlign>,
autocomplete: String,
showWordLimit: Boolean,
errorMessageAlign: String as PropType<FieldTextAlign>,
type: {

View File

@ -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` |
| left-icon | Left icon name | _string_ | `search` |
| 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

View File

@ -151,6 +151,7 @@ export default {
| input-align | 输入框内容对齐方式,可选值为 `center` `right` | _string_ | `left` |
| left-icon | 输入框左侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | `search` |
| right-icon | 输入框右侧[图标名称](#/zh-CN/icon)或图片链接 | _string_ | - |
| autocomplete `v3.2.3` | input 标签原生的[自动完成属性](https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete) | _string_ | - |
### Events

View File

@ -150,3 +150,14 @@ test('should render id prop correctly', async () => {
expect(wrapper.find('input').attributes('id')).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'
);
});