异步代码写在最后
比如一个函数里有异步,那么就把异步写在这个函数的最后
updateChildren() {
this.$children.map(vm => {
if (this.lastSelectedIndex > this.selectedIndex) {
vm.reverse = true
}
if (this.lastSelectedIndex < this.selectedIndex) {
vm.reverse = false
}
if(this.timer && !this.one){
if (this.lastSelectedIndex === this.names.length - 1 && this.selectedIndex === 0) {
vm.reverse = false
}
if (this.lastSelectedIndex === 0 && this.selectedIndex === this.names.length - 1) {
vm.reverse = true
}
}
this.$nextTick(() => {
vm.selected = this.selected
})
})
网友评论