Comments (2)
Try to change waitTimeout
property
https://github.com/alex-oleshkevich/vue-introjs#autostart
Or start tour manually when you think all components are ready.
from vue-introjs.
Thanks @alex-oleshkevich !
As you had suggested, I ended up making the following changes to make it work:
waitTimeout
in mymain.js
(as per the docs)- I ended up programmatically creating my tour entirely. I've included a rough out line of how I did it below:
watch: {
myVar: {
handler: function(){
/* only start the tour once the actual elements have finished dynamically loading in the DOM */
/* otherwise, introJS does not have any elements to actually bind to, or gets the positions wrong */
this.$nextTick(() => {
/* dynamically load my steps */
this.$intro().addSteps(
[
{
intro: "Step 1",
element: this.$refs.step_1,
position: "right",
disableInteraction: true // don't let the user click inside of the highlighted element
},
{
intro: "Step 2",
element: this.$refs.step_2,
position: "left",
disableInteraction: true
},
{
intro: "Step 3",
element: this.$refs.step_3_parent.$refs.step3_child_element,
position: "right",
disableInteraction: true
}
]
)
.setOptions({
exitOnOverlayClick: false, // don't let the user click "out" of the tour to exit
overlayOpacity: 0.5 // changed to 0.5 felt it was too dark by default
})
.start() // start the tour
.oncomplete(function () { // callback tour completion
console.log("done");
})
.onexit(function () {
console.log("exited"); // callback tour exit
});
});
},
deep: true,
immediate: false // don't load the tour right away
}
- note, in the example above, I am using vue's
$refs
attributes to identify elements when creating a new step (ie.element: this.$refs.step_1
)
This means that in my template code, there is a correspondingref="step_1"
attribute I've included for the div/element. I also had to include a ref attribute inside nested components too which allows introjs access to it for purposes of the tour.
Hope my example is useful to someone in the future. Best,
Update June 25, 2019:
Code was behaving unexpectedly, especially on Safari. It would show the tour multiple times (even on a different view), it wouldn't even have the elements on the page to bind to. I would strongly recommend switching to the new outline I've shared in issue #44
from vue-introjs.
Related Issues (20)
- This dependency was not found HOT 2
- Why this.$intro().setOptions() doesn't work? HOT 1
- ie9 support
- Unable to listen to any of the events HOT 1
- Error in mounted hook: "ReferenceError: introJs is not defined" HOT 9
- Question: onComplete
- I recommend you to write in bold that it is necessary to install intro.js
- Cannot read property 'setAttribute' of null HOT 1
- how to hear the callback onComplete in vue? HOT 1
- I need attribute like exitOnOverlayClick to forbid click mask exit those step HOT 1
- options hideNext not work HOT 1
- introjs triggers tour on completely different view HOT 1
- How do you use your intro to boot between different components in vue?
- Add document on how to use this library in jest unit tests
- add update hook to vue-intro directive
- Adding steps with .addSteps HOT 4
- CSS directive for helperNumberLayer
- Browse to another page? HOT 1
- hints don't work at all
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vue-introjs.