Question 15
Consider the below Vue component template and script definitions that use Vue router.
Template:
<template> <div> <h1>{{ pageTitle }}</h1> <router-link to="/home" v-if="showHomeLink">Home</router-link> <router-link to="/about" v-if="showAboutLink">About</router-link> <router-view></router-view> </div></template>Script:
<script>export default { name: 'App', data() { return { pageTitle: 'Vue Router Demo', showHomeLink: true, showAboutLink: false, }; }, watch: { '$route.path'() { if (this.$route.path === '/home') { this.showAboutLink = true; this.showHomeLink = false; this.pageTitle = 'Home Page'; } else if (this.$route.path === '/about') { this.showAboutLink = false; this.showHomeLink = true; this.pageTitle = 'About Page'; } else { this.pageTitle = 'Vue Router Demo'; } }, },};</script>Assuming that the corresponding routes are properly configured, what does this component structure accomplish?