vue3-directive-shepherd
Version:
A Vue3 wrapper for the library Shepherd using Vue directives
22 lines (21 loc) • 712 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
const tourStep = {
created(el, binding) {
const stepNumber = binding.arg;
const { tour, options } = binding.value;
const step = tour.getById(stepNumber);
if (!options.attachTo) {
options.attachTo = {};
}
options.attachTo.element = el;
if (!step) {
tour.addStep(Object.assign({ id: stepNumber }, options));
tour.steps.sort((a, b) => a.id - b.id);
}
else {
step.updateStepOptions(Object.assign(Object.assign({}, options), { id: stepNumber }));
}
},
};
exports.default = tourStep;
;