Vue Material Tabs failing to display content

When selecting a page from the tab using Vue Material Tab, the program should display the corresponding content. I have set up routes and installed dependencies, but the content does not show up when I click on the tab. There are two Vue components in the code to test the content of two screens - 'Menu' and 'Home'. The intention is to display a toolbar-like row at the top of the view populated with tabs.

App.vue

<template>
  <div>
     <md-tabs md-sync-route>
       <md-tab id="tab-home" md-label="Home" to="/components/Home" exact></md-tab>
       <md-tab id="tab-pages" md-label="Pages" to="/components/Menu"></md-tab>
     </md-tabs>
    <router-view/>
  </div>
</template>

<script>
  export default {
   name: 'App',
  }
</script>

index.js

import Vue from 'vue'
import Router from 'vue-router'
import Home from '@/components/Home'
import Menu from '@/components/Menu'

import VueMaterial from 'vue-material'
import 'vue-material/dist/vue-material.min.css'
import 'vue-material/dist/theme/default.css'

Vue.use(VueMaterial)
Vue.use(Router)

export default new Router({
    mode: 'history',
    routes: [
        {
            path: '/',
            name: 'Home',
            component: Home
        },
        {
            path: '/Home',
            name: 'Home',
            component: Home
        },
        {
            path: '/Menu',
            name: 'Menu',
            component: Menu
        },
    ]
})

Menu.vue

<template>
   <div>
       <h1>Menu</h1>
   </div>
</template>

<script>
    export default {
        name: 'Menu'
    }
</script>

Home.vue

<template>
  <div>
    <h1>Home</h1>
  </div>
</template>

<script>
  export default {
    name: 'Home',
  }
</script>

Answer №1

You do not have routes with the paths /components/Home and /components/Menu set up in your router configuration. Please make sure to provide the correct paths.

<md-tab id="tab-home" md-label="Home" to="/Home" exact></md-tab>
<md-tab id="tab-pages" md-label="Pages" to="/Menu"></md-tab>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Tips for rearranging button placements by utilizing multiple owl carousels across various webpages

I have successfully implemented two owl carousels on my Shopify website, and they are both functioning properly. However, I am facing an issue with the navigation buttons on the second page. The navigation buttons seem to be picking up a style that I had i ...

Having trouble editing a record in Vue.js/Vuetify/Axios after it has been created

After creating a new record, I encounter an issue where updates don't reflect in the database until I refresh the page. This behavior has left me puzzled about its cause. The sequence of events goes as follows: 1) New record creation --> data sen ...

Retrieving data from a JSON using Typescript and Angular 2

Here is an example of what my JSON data structure looks like: { "reportSections": [ { "name": "...", "display": true, "nav": false, "reportGroups": { "reports": [ { "name": "...", "ur ...

Error: The getter callback for the component `RNCSafeAreaProvider` must be a function, but it is currently undefined

After attempting to update my React Native app's dependencies using npm update, chaos ensued. To rectify the situation, I reverted back to the previous package-lock.json, deleted the node_modules folder, and re-ran npm i. Surprisingly, instead of res ...

Defining data types for an array of objects in a useState hook

I'm having trouble understanding the issue with my code. interface dataHistory { data: string, before: string | number, after: string | number, } I have an interface defined outside of the Functional Component and inside I specify its struct ...

Is there a way to retrieve Google Scholar citations using SERPAPI?

I am looking to retrieve citations for a list of authors along with their email IDs. Is there a way to programmatically fetch these citations using SERPAPI? ...

Is there a way to round a number in JavaScript with negative precision similar to the rounding function in Excel?

Is there a way to round the value 8904000 to 8900000 using Math.round? An example of this in MS Excel is shown below: =round(8904000,-5); ANS: 8900000 I attempted to use Math.round with a second argument, but it did not work as expected: Math.round(8904 ...

Unexpected database query result in Node.js

In my newuser.js file for a node.js environment with a mongodb database managed through mongoose, I have the following code: //newuser.js //This code is responsible for creating new user documents in the database and requires a GET parameter along with a ...

Incorporating a multitude of attributes into a single object

I have an array of student objects containing basic information such as Name and Address. My goal is to include a tag property in each object based on user input. To achieve this, I am using the following input: <input placeholder="new tag" ...

Having trouble displaying items on an HTML page while utilizing an AngularJS drag and drop list library?

Currently trying to add a drag and drop feature to my project. Utilizing the angular-drag-and-drop-lists library, with a working demo available for reference. Despite no errors in the console, nothing is displaying on the HTML page. I did manage to render ...

Learn the process of revealing an item by clicking on the button

Looking for help with React I have a situation where I want to reduce an item by clicking a button, but currently the button does nothing. Can someone please assist me with this issue? const [cars, setCars] = useCars([]) const handleDelete = id => ...

Maintain the button's color when clicked UNTIL it is clicked again

I am facing a challenge where I need to dynamically select multiple buttons that change color upon click. Once a button is clicked, it should change color and if clicked again, revert back to its original color. Unfortunately, I cannot rely on HTML attribu ...

Implementing a Global Location Search Box on a Leaflet Map with Vue.Js: A Step-by-Step Guide

My lecturer has tasked me with creating a map using leaflet.js within the Vue.js framework. The map should display locations globally, have functionality to search for specific locations, and allow users to switch between two different map layers. Can an ...

If the website's URL ends with `.html`, then run the JavaScript code

Need to run javascript code only when the current URL contains ".html". I have attempted the script below, but it doesn't seem to be functioning as expected. var winloc = window.location; //for example: http://mysite.com/home.html var ishtml = winlo ...

Using a WCF RESTful web service to handle POST requests and HTML forms

I have a simple .net Restful web service published on IIS: [OperationContract] [WebInvoke(Method = "GET", ResponseFormat = WebMessageFormat.Json, UriTemplate = "formTestGET?firstInput={firstInput}&socondInput={socondInput}")] string formTe ...

Choosing individual div elements to assign attributes using event listeners

I've developed a Tic-Tac-Toe game but now I'm trying to figure out how to add colors to the winning squares or draw a line. The CSS for creating the square or line is simple, but I'm unsure about selecting only the winning squares when my wi ...

How can we modify specific values of an object using Lodash and return the updated object?

const fruits = { apple: 2, orange: 3, grape: 4, banana: 5 } My aim is to adjust the values of certain fruits while being able to reference their current values. For example: const premiumFrutis = _.doSomething(fruits, apple + 2, banana + ...

Is there a way to track dynamic changes in window dimensions within Vue?

Working on my Vue mobile web app, I encountered an issue with hiding the footer when the soft keyboard appears. I've created a function to determine the window height-to-width ratio... showFooter(){ return h / w > 1.2 || h > 560; } ...and ...

The authentication function is not functioning properly within the controller when transitioning from Vue

In my controller, there is a store method where I am inserting the auth()->user()->id for a field. It works fine when submitting the form from a regular blade template, but it returns a 500 error when submitting from a Vue component. However, if I us ...

What is the process for displaying data submitted through a form on page B to page A using Node and Express?

Dealing with the issue Hello everyone. I've been struggling for the past 30 minutes trying to figure out the rendering method problem I'm facing. Whenever I try to post data through a form from Page A and then render that data on Page B, I keep ...