Merge pull request #2324 from SergioCrisostomo/auto-complete

normalize autocomplete and spellcheck
This commit is contained in:
Aresn 2017-11-06 19:11:37 -06:00 committed by GitHub
commit 32e8393a19
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 28 additions and 5 deletions

View file

@ -1,5 +1,5 @@
<template>
<form :class="classes"><slot></slot></form>
<form :class="classes" :autocomplete="autocomplete"><slot></slot></form>
</template>
<script>
// https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue
@ -32,6 +32,12 @@
showMessage: {
type: Boolean,
default: true
},
autocomplete: {
validator (value) {
return oneOf(value, ['on', 'off']);
},
default: 'off'
}
},
data () {
@ -67,14 +73,14 @@
}
if (++count === this.fields.length) {
// all finish
resolve(valid)
resolve(valid);
if (typeof callback === 'function') {
callback(valid);
}
}
});
});
})
});
},
validateField(prop, cb) {
const field = this.fields.filter(field => field.prop === prop)[0];

View file

@ -20,6 +20,7 @@
:class="inputClasses"
:disabled="disabled"
autocomplete="off"
spellcheck="false"
:autofocus="autofocus"
@focus="focus"
@blur="blur"

View file

@ -9,6 +9,7 @@
<input
:id="elementId"
:autocomplete="autocomplete"
:spellcheck="spellcheck"
ref="input"
:type="type"
:class="inputClasses"
@ -34,6 +35,7 @@
v-else
:id="elementId"
:autocomplete="autocomplete"
:spellcheck="spellcheck"
ref="textarea"
:class="textareaClasses"
:style="textareaStyles"
@ -116,6 +118,10 @@
type: Boolean,
default: false
},
spellcheck: {
type: Boolean,
default: false
},
autocomplete: {
validator (value) {
return oneOf(value, ['on', 'off']);

View file

@ -7,7 +7,13 @@
</div>
<div v-if="showElevator" :class="ElevatorClasses">
{{ t('i.page.goto') }}
<input type="text" :value="_current" @keyup.enter="changePage">
<input
type="text"
:value="_current"
autocomplete="off"
spellcheck="false"
@keyup.enter="changePage"
>
{{ t('i.page.p') }}
</div>
</div>
@ -98,4 +104,4 @@
}
}
};
</script>
</script>

View file

@ -10,6 +10,8 @@
<input
type="text"
:value="currentPage"
autocomplete="off"
spellcheck="false"
@keydown="keyDown"
@keyup="keyUp"
@change="keyUp">

View file

@ -21,6 +21,8 @@
:class="[prefixCls + '-input']"
:placeholder="showPlaceholder ? localePlaceholder : ''"
:style="inputStyle"
autocomplete="off"
spellcheck="false"
@blur="handleBlur"
@keydown="resetInputState"
@keydown.delete="handleInputDelete"