Commit c17c5ad6cbe281eff4f606289f4c6013c75e867a
1 parent
427dd34f
normalize autocomplete and spellcheck
Showing
6 changed files
with
28 additions
and
5 deletions
Show diff stats
src/components/form/form.vue
| 1 | 1 | <template> |
| 2 | - <form :class="classes"><slot></slot></form> | |
| 2 | + <form :class="classes" :autocomplete="autocomplete"><slot></slot></form> | |
| 3 | 3 | </template> |
| 4 | 4 | <script> |
| 5 | 5 | // https://github.com/ElemeFE/element/blob/dev/packages/form/src/form.vue |
| ... | ... | @@ -32,6 +32,12 @@ |
| 32 | 32 | showMessage: { |
| 33 | 33 | type: Boolean, |
| 34 | 34 | default: true |
| 35 | + }, | |
| 36 | + autocomplete: { | |
| 37 | + validator (value) { | |
| 38 | + return oneOf(value, ['on', 'off']); | |
| 39 | + }, | |
| 40 | + default: 'off' | |
| 35 | 41 | } |
| 36 | 42 | }, |
| 37 | 43 | data () { |
| ... | ... | @@ -67,14 +73,14 @@ |
| 67 | 73 | } |
| 68 | 74 | if (++count === this.fields.length) { |
| 69 | 75 | // all finish |
| 70 | - resolve(valid) | |
| 76 | + resolve(valid); | |
| 71 | 77 | if (typeof callback === 'function') { |
| 72 | 78 | callback(valid); |
| 73 | 79 | } |
| 74 | 80 | } |
| 75 | 81 | }); |
| 76 | 82 | }); |
| 77 | - }) | |
| 83 | + }); | |
| 78 | 84 | }, |
| 79 | 85 | validateField(prop, cb) { |
| 80 | 86 | const field = this.fields.filter(field => field.prop === prop)[0]; | ... | ... |
src/components/input-number/input-number.vue
src/components/input/input.vue
| ... | ... | @@ -9,6 +9,7 @@ |
| 9 | 9 | <input |
| 10 | 10 | :id="elementId" |
| 11 | 11 | :autocomplete="autocomplete" |
| 12 | + :spellcheck="spellcheck" | |
| 12 | 13 | ref="input" |
| 13 | 14 | :type="type" |
| 14 | 15 | :class="inputClasses" |
| ... | ... | @@ -34,6 +35,7 @@ |
| 34 | 35 | v-else |
| 35 | 36 | :id="elementId" |
| 36 | 37 | :autocomplete="autocomplete" |
| 38 | + :spellcheck="spellcheck" | |
| 37 | 39 | ref="textarea" |
| 38 | 40 | :class="textareaClasses" |
| 39 | 41 | :style="textareaStyles" |
| ... | ... | @@ -116,6 +118,10 @@ |
| 116 | 118 | type: Boolean, |
| 117 | 119 | default: false |
| 118 | 120 | }, |
| 121 | + spellcheck: { | |
| 122 | + type: Boolean, | |
| 123 | + default: false | |
| 124 | + }, | |
| 119 | 125 | autocomplete: { |
| 120 | 126 | validator (value) { |
| 121 | 127 | return oneOf(value, ['on', 'off']); | ... | ... |
src/components/page/options.vue
| ... | ... | @@ -7,7 +7,13 @@ |
| 7 | 7 | </div> |
| 8 | 8 | <div v-if="showElevator" :class="ElevatorClasses"> |
| 9 | 9 | {{ t('i.page.goto') }} |
| 10 | - <input type="text" :value="_current" @keyup.enter="changePage"> | |
| 10 | + <input | |
| 11 | + type="text" | |
| 12 | + :value="_current" | |
| 13 | + autocomplete="off" | |
| 14 | + spellcheck="false" | |
| 15 | + @keyup.enter="changePage" | |
| 16 | + > | |
| 11 | 17 | {{ t('i.page.p') }} |
| 12 | 18 | </div> |
| 13 | 19 | </div> |
| ... | ... | @@ -98,4 +104,4 @@ |
| 98 | 104 | } |
| 99 | 105 | } |
| 100 | 106 | }; |
| 101 | -</script> | |
| 102 | 107 | \ No newline at end of file |
| 108 | +</script> | ... | ... |
src/components/page/page.vue
src/components/select/select.vue
| ... | ... | @@ -21,6 +21,8 @@ |
| 21 | 21 | :class="[prefixCls + '-input']" |
| 22 | 22 | :placeholder="showPlaceholder ? localePlaceholder : ''" |
| 23 | 23 | :style="inputStyle" |
| 24 | + autocomplete="off" | |
| 25 | + spellcheck="false" | |
| 24 | 26 | @blur="handleBlur" |
| 25 | 27 | @keydown="resetInputState" |
| 26 | 28 | @keydown.delete="handleInputDelete" | ... | ... |