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