Last active
March 11, 2021 15:02
-
-
Save LeandrodeLimaC/6d0d58d1f07cb3943318e622be0a67d3 to your computer and use it in GitHub Desktop.
Driver js on VUE 2 ( "driver.js": "^0.9.8" )
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
import Driver from 'driver.js'; | |
import 'driver.js/dist/driver.min.css'; | |
import { steps } from './steps'; | |
export default { | |
computed: { | |
driver() { | |
return new Driver({ | |
className: 'driverjs-popover', | |
animate: true, | |
opacity: 0.75, | |
padding: 10, | |
allowClose: true, | |
overlayClickNext: false, | |
doneBtnText: 'Finalizar', | |
closeBtnText: 'Fechar', | |
nextBtnText: 'Proximo', | |
prevBtnText: 'Voltar', | |
}); | |
}, | |
}, | |
methods: { | |
guide(stepGuideName) { | |
if (steps[stepGuideName]) { | |
this.driver.defineSteps(steps[stepGuideName]); | |
return this.driver.start(); | |
} | |
throw Error('Step Guide not Found'); | |
}, | |
}, | |
}; | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import stockPageSteps from './stockPageSteps'; | |
export const steps = { | |
useExampleSteps, | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<button @click.stop="guide('useExampleSteps')"> guide </button> | |
<input id="order_fields"> | |
</template> | |
<script> | |
import guiderMixin from '@/mixins/guider/guiderMixin'; | |
export default { | |
mixins: [guiderMixin], | |
} | |
</script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const useExampleSteps = [ | |
{ | |
element: '#order_fields', | |
popover: { | |
title: 'Menu Navigation', | |
description: 'Click the menu to switch the content of the menu on the right', | |
position: 'right', | |
}, | |
}, | |
] | |
export default useExampleSteps |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment