Skip to content

Commit dec6fae

Browse files
committed
fix(component): Hide Previous button on #actions overwrite #25
1 parent 34375e0 commit dec6fae

3 files changed

Lines changed: 23 additions & 11 deletions

File tree

docs/guide/methods.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ The `nextStep();` method is used to move to the next step in the tour.
144144
<div>
145145
...
146146
<VTour :steps="steps" autoStart>
147-
<template #actions="{ nextStep, prevStep, endTour }">
147+
<template #actions="{ nextStep, prevStep, endTour, step }">
148148
<button type="button" @click.prevent="nextStep">Next Step</button>
149149
</template>
150150
</VTour>

docs/guide/props.md

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@
44
VueJS Tour is written for Vue 3. There are no plans to support Vue 2.x
55
:::
66

7-
| Prop | Type | Default | Required | Description |
8-
|:------------:|:---------:|:-----------:|:--------:|-----------------------------------------------------------------------------|
9-
| `steps` | `Array` | `undefined` | `true` | An array of steps to be used in the tour. |
10-
| `autoStart` | `Boolean` | `false` | `false` | If `true`, the tour will start automatically when the component is mounted. |
11-
| `startDelay` | `Number` | `0` | `false` | If set, the tour will start after x miliseconds. |
12-
| `highlight` | `Boolean` | `false` | `false` | If `true`, the target will get highlighted. |
7+
| Prop | Type | Default | Required | Description |
8+
|:-------------:|:---------:|:--------------------------------------------------------------:|:--------:|-----------------------------------------------------------------------------|
9+
| `steps` | `Array` | `undefined` | `true` | An array of steps to be used in the tour. |
10+
| `autoStart` | `Boolean` | `false` | `false` | If `true`, the tour will start automatically when the component is mounted. |
11+
| `startDelay` | `Number` | `0` | `false` | If set, the tour will start after x miliseconds. |
12+
| `highlight` | `Boolean` | `false` | `false` | If `true`, the target will get highlighted. |
13+
| `buttonLabel` | `Object` | `{ next: "Next", prev: "Back", finish: "Finish", skip: "Skip"}` | `false` | The labels used for the buttons. |
1314

1415
## Example
1516

src/components/VTour.vue

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
<slot name="content" v-bind="{ step }">
44
<div v-html="step.getCurrentStep.content"></div>
55
</slot>
6-
<slot name="actions" v-bind="{ endTour, nextStep, prevStep }">
6+
<slot name="actions" v-bind="{ endTour, nextStep, prevStep, step }">
77
<div class="vjt-actions">
88
<button type="button" @click.prevent="endTour">Skip</button>
9-
<button v-if="step.currentStep > 0" type="button" @click.prevent="prevStep">Back</button>
9+
<button v-if="step.currentStep > 0" type="button" v-text="props.buttonLabels.prev" @click.prevent="prevStep"></button>
1010
<button type="button" v-text="getNextText" @click.prevent="nextStep"></button>
1111
</div>
1212
</slot>
@@ -34,7 +34,7 @@ const maxSteps = computed(() => {
3434
return props.steps.length - 1;
3535
});
3636
const getNextText = computed(() => {
37-
return step.currentStep === maxSteps.value ? "Finish" : "Next";
37+
return step.currentStep === maxSteps.value ? props.buttonLabels.finish : props.buttonLabels.next;
3838
});
3939
4040
const props = defineProps({
@@ -53,7 +53,18 @@ const props = defineProps({
5353
highlight: {
5454
type: Boolean,
5555
default: false
56-
}
56+
},
57+
buttonLabels: {
58+
type: Object,
59+
default: () => {
60+
return {
61+
next: "Next",
62+
prev: "Back",
63+
finish: "Finish",
64+
skip: "Skip"
65+
};
66+
}
67+
},
5768
});
5869
const emit = defineEmits(["onTourStart", "onTourEnd"]);
5970
defineExpose({

0 commit comments

Comments
 (0)