Merge pull request #1999 from SergioCrisostomo/remove-array-find

remove Array.find to make IE11 happy
This commit is contained in:
Aresn 2017-09-27 02:04:55 -05:00 committed by GitHub
commit 1d8334dd3e

View file

@ -171,30 +171,26 @@
const times = ['hours', 'minutes', 'seconds'];
this.$nextTick(() => {
times.forEach(type => {
this.$refs[type].scrollTop = 24 * this.getItemIndex(type, this[type]);
this.$refs[type].scrollTop = 24 * this[`${type}List`].findIndex(obj => obj.text == this[type]);
});
});
},
formatTime (text) {
return text < 10 ? '0' + text : text;
},
getItemIndex(type, val){
const item = this[`${type}List`].find(obj => obj.text == val);
return this[`${type}List`].indexOf(item);
}
},
watch: {
hours (val) {
if (!this.compiled) return;
this.scroll('hours', this.getItemIndex('hours', val));
this.scroll('hours', this.hoursList.findIndex(obj => obj.text == val));
},
minutes (val) {
if (!this.compiled) return;
this.scroll('minutes', this.getItemIndex('minutes', val));
this.scroll('minutes', this.minutesList.findIndex(obj => obj.text == val));
},
seconds (val) {
if (!this.compiled) return;
this.scroll('seconds', this.getItemIndex('seconds', val));
this.scroll('seconds', this.secondsList.findIndex(obj => obj.text == val));
}
},
mounted () {