From effbd1dd18708a610670765bdad2416af9e18d7d Mon Sep 17 00:00:00 2001 From: Andreas Offenhaeuser Date: Mon, 3 Feb 2020 23:18:31 +0100 Subject: [PATCH] feat: add options.debug flag for console output #101 --- src/components/VStep.vue | 16 ++++++++++++---- src/components/VTour.vue | 7 +++++-- src/shared/constants.js | 3 ++- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/src/components/VStep.vue b/src/components/VStep.vue index 98b7804..78ca832 100644 --- a/src/components/VStep.vue +++ b/src/components/VStep.vue @@ -58,6 +58,9 @@ export default { }, highlight: { type: Boolean + }, + debug: { + type: Boolean } }, data () { @@ -77,8 +80,9 @@ export default { }, methods: { createStep () { - // TODO: debug mode - // console.log('[Vue Tour] The target element ' + this.step.target + ' of .v-step[id="' + this.hash + '"] is:', targetElement) + if (this.debug) { + console.log('[Vue Tour] The target element ' + this.step.target + ' of .v-step[id="' + this.hash + '"] is:', this.targetElement) + } if (this.targetElement) { this.enableScrolling() @@ -91,7 +95,9 @@ export default { this.params ) } else { - console.error('[Vue Tour] The target element ' + this.step.target + ' of .v-step[id="' + this.hash + '"] does not exist!') + if (this.debug) { + console.error('[Vue Tour] The target element ' + this.step.target + ' of .v-step[id="' + this.hash + '"] does not exist!') + } this.$emit('targetNotFound', this.step) } }, @@ -113,7 +119,9 @@ export default { } }, isHighlightEnabled () { - console.log(`[Vue Tour] Highlight is ${this.params.highlight ? 'enabled' : 'disabled'} for .v-step[id="${this.hash}"]`) + if (this.debug) { + console.log(`[Vue Tour] Highlight is ${this.params.highlight ? 'enabled' : 'disabled'} for .v-step[id="${this.hash}"]`) + } return this.params.highlight }, createHighlight () { diff --git a/src/components/VTour.vue b/src/components/VTour.vue index 890cfc4..ac52235 100644 --- a/src/components/VTour.vue +++ b/src/components/VTour.vue @@ -10,6 +10,7 @@ :is-last="isLast" :labels="customOptions.labels" :highlight="customOptions.highlight" + :debug="customOptions.debug" >