路由器不显示内容VueJS
问题描述:
我在vuejs和由于某种原因,它不显示内容时切换到另一个路线。我有以下代码: 在App.vue - >路由器不显示内容VueJS
<template>
<div>
<router-view> </router-view>
</div>
</template>
在我routes.js - >
import Support from './components/support/Support.vue';
import Detailed from './components/support/details/Detailed.vue';
export const routes =[
{path: '/support', component: Support, children: [
{path: 'detailed', component: Detailed, name: 'detailed'}
]},
];
我Support.vue
我有一个组件 - >
<div class="row">
<component :is = "selectedComponent"> </component>
</div>
并且选中该组件时会显示某些内容。这里面的内容我有 - >
<div class="most-asked">
<ul>
<router-link :to ="{name: 'detailed'}" tag = 'li'> Test </router-link>
</ul>
当我按它的URL改变了我的浏览器=>“/支持/详细”,但它不我重定向到该页面。 关于为什么会发生以及如何解决它的任何想法?
PS如果我让航线routes.js单独像 - > /详细和/支,然后将其重定向我完全没有问题,但一旦我做支撑一个孩子,它不去了,
PSS和由于某种原因,它告诉我,有时我的浏览器,它无法加载文件,如 (Failed to load resource: http://localhost:8080/support/src/vendors/css/grid.css Failed to the server responded with a status of 404 (Not Found)
和http://localhost:8080/support/src/vendors/css/ionicons.min.css Failed to load resource: the server responded with a status of 404 (Not Found)
我假设,如果我包括引导和等,其也不会找到它的路线(为什么?),但是如果把所有这些路线分开放置,没有任何c孩子们工作得很好。
答
据我了解它不显示它的原因,因为它需要另一个<router-view> </router-view>
除了根目录之外。因此,转发问题是,您可以创建什么样的逻辑来切换网页?
更改路径为'/详细'在子路线 –
我以前试过。在浏览器url中,它会更改为/详细信息,但会保留在/ support的同一页面上 – Stan