【问题标题】:Can't see named routes看不到命名路线
【发布时间】:2019-08-05 10:49:01
【问题描述】:

我确定我在做一些愚蠢的事情,但我就是无法让它发挥作用。 我在一个单独的 js 文件中定义了路由,将其导入到一个新创建的路由器中,并安装在 vue.js 中。 在 vue devtools 中,我确实看到了我的命名路由,但是 RouterView 在 vue devtools 中的位置,html 显示

Routes.js:

import Home from '@/Views/Home.vue';
import NewProefwerk from '@/Views/NewProefwerk.vue';

const routes = [
    {
        path: '/',
        name: 'home',
        Component: Home
    },
    {
        path: '/Nieuw',
        name: 'new',
        Component: NewProefwerk
    }
];

export default routes;

main.js:

import VueRouter from 'vue-router';
import routes from '@/Routes'
Vue.use(VueRouter);

const router = new VueRouter({
    mode: 'history',
    base: '/',
    routes
})

new Vue({
    router,
    render: h => h(App)
}).$mount('#app');

App.vue:

<template>
    <div id="app">
        <Navigation></Navigation>
        <router-view></router-view>
    </div>
</template>

<script>
    import Navigation from '@/components/Navigation.vue';

    export default {
        name: 'app',
        components: {
            Navigation
        }
    };
</script>

【问题讨论】:

    标签: vue.js vue-router


    【解决方案1】:

    尝试将Component 更改为component

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-01-23
      相关资源
      最近更新 更多