Commit d5e4481451ab63e7ad4f65dcf89dae97f5a0baac
1 parent
a65aef1a
remove Array.find to make IE11 happy
Showing
1 changed file
with
4 additions
and
8 deletions
Show diff stats
src/components/date-picker/base/time-spinner.vue
@@ -171,30 +171,26 @@ | @@ -171,30 +171,26 @@ | ||
171 | const times = ['hours', 'minutes', 'seconds']; | 171 | const times = ['hours', 'minutes', 'seconds']; |
172 | this.$nextTick(() => { | 172 | this.$nextTick(() => { |
173 | times.forEach(type => { | 173 | times.forEach(type => { |
174 | - this.$refs[type].scrollTop = 24 * this.getItemIndex(type, this[type]); | 174 | + this.$refs[type].scrollTop = 24 * this[`${type}List`].findIndex(obj => obj.text == this[type]); |
175 | }); | 175 | }); |
176 | }); | 176 | }); |
177 | }, | 177 | }, |
178 | formatTime (text) { | 178 | formatTime (text) { |
179 | return text < 10 ? '0' + text : text; | 179 | return text < 10 ? '0' + text : text; |
180 | - }, | ||
181 | - getItemIndex(type, val){ | ||
182 | - const item = this[`${type}List`].find(obj => obj.text == val); | ||
183 | - return this[`${type}List`].indexOf(item); | ||
184 | } | 180 | } |
185 | }, | 181 | }, |
186 | watch: { | 182 | watch: { |
187 | hours (val) { | 183 | hours (val) { |
188 | if (!this.compiled) return; | 184 | if (!this.compiled) return; |
189 | - this.scroll('hours', this.getItemIndex('hours', val)); | 185 | + this.scroll('hours', this.hoursList.findIndex(obj => obj.text == val)); |
190 | }, | 186 | }, |
191 | minutes (val) { | 187 | minutes (val) { |
192 | if (!this.compiled) return; | 188 | if (!this.compiled) return; |
193 | - this.scroll('minutes', this.getItemIndex('minutes', val)); | 189 | + this.scroll('minutes', this.minutesList.findIndex(obj => obj.text == val)); |
194 | }, | 190 | }, |
195 | seconds (val) { | 191 | seconds (val) { |
196 | if (!this.compiled) return; | 192 | if (!this.compiled) return; |
197 | - this.scroll('seconds', this.getItemIndex('seconds', val)); | 193 | + this.scroll('seconds', this.secondsList.findIndex(obj => obj.text == val)); |
198 | } | 194 | } |
199 | }, | 195 | }, |
200 | mounted () { | 196 | mounted () { |