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