Question 15
Consider the below Vue.js application.
<template> <div> <button @click="goToPage('Home')">Go to Home</button> <button @click="goToPage('About')">Go to About</button> <button @click="goToPage('Contact')">Go to Contact</button>
<div v-if="visitedPages.length"> <h3>Visited Pages:</h3> <ul> <li v-for="(page, index) in visitedPages" :key="index">{{ page}}</li> </ul> </div> </div></template>
<script>export default { data() { return { visitedPages: [] }; }, mounted() { const storedPages = JSON.parse(sessionStorage.getItem('visitedPages'))|| []; this.visitedPages = storedPages; }, methods: { goToPage(page) { this.visitedPages.push(page); sessionStorage.setItem('visitedPages',JSON.stringify(this.visitedPages)); this.$router.push(`/${page.toLowerCase()}`); } }};</script>What will be the visited pages history when the user navigates between pages and refreshes the page?
The list of visited pages will reset to empty after the page is refreshed.
The list of visited pages will be updated with the current page after every navigation and will not reset even after reload.
The navigation history will not be stored in sessionStorage.
All of these