Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 23 additions & 9 deletions src/components/VStep.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ export default {
stopOnFail: {
type: Boolean
},
continueWhenFail: {
type: Boolean
},
forward: {
type: Boolean
},
debug: {
type: Boolean
}
Expand Down Expand Up @@ -128,6 +134,12 @@ export default {
this.$emit('targetNotFound', this.step)
if (this.stopOnFail) {
this.stop()
} else if (this.continueWhenFail) {
if (this.forward) {
this.nextStep()
} else {
this.previousStep()
}
}
}
}
Expand Down Expand Up @@ -176,15 +188,17 @@ export default {
},
removeHighlight () {
if (this.isHighlightEnabled()) {
const target = this.targetElement
const currentTransition = this.targetElement.style.transition
this.targetElement.classList.remove(HIGHLIGHT.classes.targetHighlighted)
this.targetElement.classList.remove(HIGHLIGHT.classes.targetRelative)
// Remove our transition when step is finished.
if (currentTransition.includes(HIGHLIGHT.transition)) {
setTimeout(() => {
target.style.transition = currentTransition.replace(`, ${HIGHLIGHT.transition}`, '')
}, 0)
if (this.targetElement) {
const target = this.targetElement
const currentTransition = this.targetElement.style.transition
this.targetElement.classList.remove(HIGHLIGHT.classes.targetHighlighted)
this.targetElement.classList.remove(HIGHLIGHT.classes.targetRelative)
// Remove our transition when step is finished.
if (currentTransition.includes(HIGHLIGHT.transition)) {
setTimeout(() => {
target.style.transition = currentTransition.replace(`, ${HIGHLIGHT.transition}`, '')
}, 0)
}
}
}
},
Expand Down
7 changes: 6 additions & 1 deletion src/components/VTour.vue
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,12 @@
:finish="finish"
:is-first="isFirst"
:is-last="isLast"
:forward="forward"
:labels="customOptions.labels"
:enabled-buttons="customOptions.enabledButtons"
:highlight="customOptions.highlight"
:stop-on-fail="customOptions.stopOnTargetNotFound"
:continue-when-fail="customOptions.continueWhenTargetNotFound"
:debug="customOptions.debug"
@targetNotFound="$emit('targetNotFound', $event)"
>
Expand Down Expand Up @@ -66,7 +68,8 @@ export default {
},
data () {
return {
currentStep: -1
currentStep: -1,
forward: true
}
},
mounted () {
Expand Down Expand Up @@ -144,6 +147,7 @@ export default {
let futureStep = this.currentStep - 1

let process = () => new Promise((resolve, reject) => {
this.forward = false
this.customCallbacks.onPreviousStep(this.currentStep)
this.currentStep = futureStep
resolve()
Expand All @@ -167,6 +171,7 @@ export default {
let futureStep = this.currentStep + 1

let process = () => new Promise((resolve, reject) => {
this.forward = true
this.customCallbacks.onNextStep(this.currentStep)
this.currentStep = futureStep
resolve()
Expand Down
1 change: 1 addition & 0 deletions src/shared/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export const DEFAULT_OPTIONS = {
},
startTimeout: 0,
stopOnTargetNotFound: true,
continueWhenTargetNotFound: false,
useKeyboardNavigation: true,
enabledNavigationKeys: {
escape: true,
Expand Down