Skip to content

Instantly share code, notes, and snippets.

@LeandrodeLimaC
Last active March 11, 2021 15:02
Show Gist options
  • Save LeandrodeLimaC/6d0d58d1f07cb3943318e622be0a67d3 to your computer and use it in GitHub Desktop.
Save LeandrodeLimaC/6d0d58d1f07cb3943318e622be0a67d3 to your computer and use it in GitHub Desktop.
Driver js on VUE 2 ( "driver.js": "^0.9.8" )
<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>
import stockPageSteps from './stockPageSteps';
export const steps = {
useExampleSteps,
}
<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>
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