iview/src/components/carousel/carousel-item.vue
houyl ccf544dcc2 Merge branch 'master' of https://github.com/iview/iview into 2.0
Update carousel component: add loop and radiusDot property
# Conflicts:
#	package.json
#	src/components/date-picker/picker.vue
#	src/components/select/select.vue
2017-10-24 16:47:12 +08:00

43 lines
1.1 KiB
Vue

<template>
<div :class="prefixCls" :style="styles"><slot></slot></div>
</template>
<script>
const prefixCls = 'ivu-carousel-item';
export default {
componentName: 'carousel-item',
name: 'CarouselItem',
data () {
return {
prefixCls: prefixCls,
width: 0,
height: 'auto',
left: 0
};
},
computed: {
styles () {
return {
width: `${this.width}px`,
height: `${this.height}`,
left: `${this.left}px`
};
}
},
mounted () {
this.$parent.slotChange();
},
watch: {
width (val) {
if (val && this.$parent.loop) {
this.$nextTick(() => {
this.$parent.initCopyTrackDom();
});
}
}
},
beforeDestroy () {
this.$parent.slotChange();
}
};
</script>