Commit 64f80f51 authored by Leopoldthecoder's avatar Leopoldthecoder Committed by 杨奕

Carousel: fix initial-index

parent 3883ab34
...@@ -99,11 +99,11 @@ ...@@ -99,11 +99,11 @@
}, },
created() { created() {
this.$parent && this.$parent.handleItemChange(); this.$parent && this.$parent.updateItems();
}, },
destroyed() { destroyed() {
this.$parent && this.$parent.handleItemChange(); this.$parent && this.$parent.updateItems();
} }
}; };
</script> </script>
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
<script> <script>
import throttle from 'throttle-debounce/throttle'; import throttle from 'throttle-debounce/throttle';
import debounce from 'throttle-debounce/debounce';
import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event'; import { addResizeListener, removeResizeListener } from 'element-ui/src/utils/resize-event';
export default { export default {
...@@ -103,7 +102,7 @@ export default { ...@@ -103,7 +102,7 @@ export default {
watch: { watch: {
items(val) { items(val) {
if (val.length > 0) this.setActiveItem(0); if (val.length > 0) this.setActiveItem(this.initialIndex);
}, },
activeIndex(val, oldVal) { activeIndex(val, oldVal) {
...@@ -223,7 +222,6 @@ export default { ...@@ -223,7 +222,6 @@ export default {
}, },
created() { created() {
this.handleItemChange = debounce(100, this.updateItems);
this.throttledArrowClick = throttle(300, true, index => { this.throttledArrowClick = throttle(300, true, index => {
this.setActiveItem(index); this.setActiveItem(index);
}); });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment