mirror of https://github.com/ElemeFE/element
				
				
				
			Carousel: fix initial-index
							parent
							
								
									3883ab3427
								
							
						
					
					
						commit
						64f80f51a7
					
				| 
						 | 
				
			
			@ -99,11 +99,11 @@
 | 
			
		|||
    },
 | 
			
		||||
 | 
			
		||||
    created() {
 | 
			
		||||
      this.$parent && this.$parent.handleItemChange();
 | 
			
		||||
      this.$parent && this.$parent.updateItems();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    destroyed() {
 | 
			
		||||
      this.$parent && this.$parent.handleItemChange();
 | 
			
		||||
      this.$parent && this.$parent.updateItems();
 | 
			
		||||
    }
 | 
			
		||||
  };
 | 
			
		||||
</script>
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -49,7 +49,6 @@
 | 
			
		|||
 | 
			
		||||
<script>
 | 
			
		||||
import throttle from 'throttle-debounce/throttle';
 | 
			
		||||
import debounce from 'throttle-debounce/debounce';
 | 
			
		||||
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
 | 
			
		||||
 | 
			
		||||
export default {
 | 
			
		||||
| 
						 | 
				
			
			@ -103,7 +102,7 @@ export default {
 | 
			
		|||
 | 
			
		||||
  watch: {
 | 
			
		||||
    items(val) {
 | 
			
		||||
      if (val.length > 0) this.setActiveItem(0);
 | 
			
		||||
      if (val.length > 0) this.setActiveItem(this.initialIndex);
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    activeIndex(val, oldVal) {
 | 
			
		||||
| 
						 | 
				
			
			@ -223,7 +222,6 @@ export default {
 | 
			
		|||
  },
 | 
			
		||||
 | 
			
		||||
  created() {
 | 
			
		||||
    this.handleItemChange = debounce(100, this.updateItems);
 | 
			
		||||
    this.throttledArrowClick = throttle(300, true, index => {
 | 
			
		||||
      this.setActiveItem(index);
 | 
			
		||||
    });
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue