Commit 8f4e2cf0c3cf675ac3748783203424f18994dbb9

Authored by Rijn
1 parent 5e8be9b3

update pos when slot changes.

added remove test
src/components/carousel/carousel-item.vue
... ... @@ -22,5 +22,10 @@
22 22 }
23 23 }
24 24 },
  25 + compiled () {
  26 + // this.$parent.slotChange();
  27 + // this.$parent.updateSlides(true, true);
  28 + // this.$parent.updatePos();
  29 + }
25 30 };
26 31 </script>
... ...
src/components/carousel/carousel.vue
... ... @@ -125,6 +125,8 @@
125 125 });
126 126  
127 127 this.slides = slides;
  128 +
  129 + this.updatePos();
128 130 },
129 131 updatePos () {
130 132 this.findChild((child) => {
... ...
test/routers/carousel.vue
... ... @@ -21,6 +21,7 @@
21 21 </i-col>
22 22 <i-col span="4">
23 23 <i-button @click="push">Push</i-button>
  24 + <i-button @click="remove = true">Remove</i-button>
24 25 </i-col>
25 26 </Row>
26 27 <Carousel style="width: 50%; border: solid 1px #000"
... ... @@ -28,7 +29,7 @@
28 29 :autoplay="autoplay"
29 30 :autoplay-speed="autoplaySpeed"
30 31 easing="linear">
31   - <Carousel-item>
  32 + <Carousel-item v-if="!remove">
32 33 <Alert type="warning" show-icon>
33 34 警告提示文案
34 35 <template slot="desc">
... ... @@ -52,6 +53,7 @@
52 53 currentIndex: 0,
53 54 autoplay: true,
54 55 autoplaySpeed: 2000,
  56 + remove: false,
55 57 pushItem: []
56 58 }
57 59 },
... ...