Merge pull request #2324 from SergioCrisostomo/auto-complete
normalize autocomplete and spellcheck
This commit is contained in:
commit
32e8393a19
6 changed files with 28 additions and 5 deletions
|
@ -1,5 +1,5 @@
|
||||||
<template>
|
<template>
|
||||||
<form :class="classes"><slot></slot></form>
|
<form :class="classes" :autocomplete="autocomplete"><slot></slot></form>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
// https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue
|
// https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue
|
||||||
|
@ -32,6 +32,12 @@
|
||||||
showMessage: {
|
showMessage: {
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: true
|
default: true
|
||||||
|
},
|
||||||
|
autocomplete: {
|
||||||
|
validator (value) {
|
||||||
|
return oneOf(value, ['on', 'off']);
|
||||||
|
},
|
||||||
|
default: 'off'
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
data () {
|
data () {
|
||||||
|
@ -67,14 +73,14 @@
|
||||||
}
|
}
|
||||||
if (++count === this.fields.length) {
|
if (++count === this.fields.length) {
|
||||||
// all finish
|
// all finish
|
||||||
resolve(valid)
|
resolve(valid);
|
||||||
if (typeof callback === 'function') {
|
if (typeof callback === 'function') {
|
||||||
callback(valid);
|
callback(valid);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
},
|
},
|
||||||
validateField(prop, cb) {
|
validateField(prop, cb) {
|
||||||
const field = this.fields.filter(field => field.prop === prop)[0];
|
const field = this.fields.filter(field => field.prop === prop)[0];
|
||||||
|
|
|
@ -20,6 +20,7 @@
|
||||||
:class="inputClasses"
|
:class="inputClasses"
|
||||||
:disabled="disabled"
|
:disabled="disabled"
|
||||||
autocomplete="off"
|
autocomplete="off"
|
||||||
|
spellcheck="false"
|
||||||
:autofocus="autofocus"
|
:autofocus="autofocus"
|
||||||
@focus="focus"
|
@focus="focus"
|
||||||
@blur="blur"
|
@blur="blur"
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
<input
|
<input
|
||||||
:id="elementId"
|
:id="elementId"
|
||||||
:autocomplete="autocomplete"
|
:autocomplete="autocomplete"
|
||||||
|
:spellcheck="spellcheck"
|
||||||
ref="input"
|
ref="input"
|
||||||
:type="type"
|
:type="type"
|
||||||
:class="inputClasses"
|
:class="inputClasses"
|
||||||
|
@ -34,6 +35,7 @@
|
||||||
v-else
|
v-else
|
||||||
:id="elementId"
|
:id="elementId"
|
||||||
:autocomplete="autocomplete"
|
:autocomplete="autocomplete"
|
||||||
|
:spellcheck="spellcheck"
|
||||||
ref="textarea"
|
ref="textarea"
|
||||||
:class="textareaClasses"
|
:class="textareaClasses"
|
||||||
:style="textareaStyles"
|
:style="textareaStyles"
|
||||||
|
@ -116,6 +118,10 @@
|
||||||
type: Boolean,
|
type: Boolean,
|
||||||
default: false
|
default: false
|
||||||
},
|
},
|
||||||
|
spellcheck: {
|
||||||
|
type: Boolean,
|
||||||
|
default: false
|
||||||
|
},
|
||||||
autocomplete: {
|
autocomplete: {
|
||||||
validator (value) {
|
validator (value) {
|
||||||
return oneOf(value, ['on', 'off']);
|
return oneOf(value, ['on', 'off']);
|
||||||
|
|
|
@ -7,7 +7,13 @@
|
||||||
</div>
|
</div>
|
||||||
<div v-if="showElevator" :class="ElevatorClasses">
|
<div v-if="showElevator" :class="ElevatorClasses">
|
||||||
{{ t('i.page.goto') }}
|
{{ 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') }}
|
{{ t('i.page.p') }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -98,4 +104,4 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -10,6 +10,8 @@
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
:value="currentPage"
|
:value="currentPage"
|
||||||
|
autocomplete="off"
|
||||||
|
spellcheck="false"
|
||||||
@keydown="keyDown"
|
@keydown="keyDown"
|
||||||
@keyup="keyUp"
|
@keyup="keyUp"
|
||||||
@change="keyUp">
|
@change="keyUp">
|
||||||
|
|
|
@ -21,6 +21,8 @@
|
||||||
:class="[prefixCls + '-input']"
|
:class="[prefixCls + '-input']"
|
||||||
:placeholder="showPlaceholder ? localePlaceholder : ''"
|
:placeholder="showPlaceholder ? localePlaceholder : ''"
|
||||||
:style="inputStyle"
|
:style="inputStyle"
|
||||||
|
autocomplete="off"
|
||||||
|
spellcheck="false"
|
||||||
@blur="handleBlur"
|
@blur="handleBlur"
|
||||||
@keydown="resetInputState"
|
@keydown="resetInputState"
|
||||||
@keydown.delete="handleInputDelete"
|
@keydown.delete="handleInputDelete"
|
||||||
|
|
Loading…
Add table
Reference in a new issue