Skip to content

Commit 8edc682

Browse files
committed
Update docs use slot navigation
1 parent 9388fc1 commit 8edc682

13 files changed

+308
-130
lines changed

.npmignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,4 @@ yarn-error.log
1212
.browserslistrc
1313
dist/demo.html
1414
dist/bit
15+
src/

README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -188,26 +188,36 @@ To listen for the 'slideclick' event you can do the following:
188188

189189
```html
190190
<template>
191-
<Carousel ref="carousel">
191+
<Carousel ref="carousel" @page-change="handlePageChange">
192192
<Slide>
193193
Slide 1 Content
194194
</Slide>
195195
<Slide>
196196
Slide 2 Content
197197
</Slide>
198198
<div class="custom-navigation" slot="navigation">
199-
<button type="button" @click="onChangeNavigation('backward')">Back</button>
200-
<button type="button" @click="onChangeNavigation('forward')">Next</button>
199+
<button type="button" :disabled="currentPage > 0" @click="onChangeNavigation('backward')">Back</button>
200+
<button type="button" :disabled="!isEnableForward" @click="onChangeNavigation('forward')">Next</button>
201201
</div>
202202
<ul class="custom-pagination" slot="pagination">
203203
<li @click="onChangePagination(1)">1</li>
204-
<li @click="onChangePagination(1)">2</li>
204+
<li @click="onChangePagination(2)">2</li>
205205
</ul>
206206
</Carousel>
207207
</template>
208208
<script>
209209
export default {
210+
data() {
211+
return {
212+
currentPage: 0,
213+
isEnableForward: true,
214+
}
215+
},
210216
methods: {
217+
handlePageChange(currentPage) {
218+
this.currentPage = currentPage
219+
this.isEnableForward = this.$refs.carousel.canAdvanceForward
220+
},
211221
onChangePagination(index) {
212222
this.$refs.carousel.goToPage(index, 'pagination')
213223
},

dist/vue-concise-carousel.common.js

Lines changed: 142 additions & 58 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-concise-carousel.common.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/vue-concise-carousel.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)