I am currently working on building an application that is not a single page application. As I develop my project, I have several div
elements on the page that I want to toggle visibility step by step. Below is the snippet of my code:
<div v-if="sectionIs('section1')" class="container">
</div>
<div v-if="sectionIs('section2')" class="container">
</div>
<div v-if="sectionIs('section3')" class="container">
</div>
In my JavaScript file:
var vm = new Vue({
el: '#standard_registeration',
data: {
section : 'section1',
},
computed: {
sectionIs: function (sectionName) {
return this.section === sectionName;
}
}
});
I would like to confirm if this method is correct, or if there are more efficient ways to achieve the same result? Additionally, how can I incorporate animations in the future?