update Carousel

This commit is contained in:
梁灏 2017-07-10 13:33:14 +08:00
parent e129a2508c
commit 1dad8a571e

View file

@ -25,6 +25,7 @@
<script> <script>
import Icon from '../icon/icon.vue'; import Icon from '../icon/icon.vue';
import { getStyle, oneOf } from '../../utils/assist'; import { getStyle, oneOf } from '../../utils/assist';
import { on, off } from '../../utils/dom';
const prefixCls = 'ivu-carousel'; const prefixCls = 'ivu-carousel';
@ -240,10 +241,12 @@
this.updateSlides(true); this.updateSlides(true);
this.handleResize(); this.handleResize();
this.setAutoplay(); this.setAutoplay();
window.addEventListener('resize', this.handleResize, false); // window.addEventListener('resize', this.handleResize, false);
on(window, 'resize', this.handleResize);
}, },
beforeDestroy () { beforeDestroy () {
window.removeEventListener('resize', this.handleResize, false); // window.removeEventListener('resize', this.handleResize, false);
off(window, 'resize', this.handleResize);
} }
}; };
</script> </script>