小编wcj*_*n11的帖子

使用Iron Router,"路由器未定义"

我已经添加了铁路由器到我的应用程序来处理主页,关于页面和应用程序的主页面之间的路由,这是一张地图

在添加了带有陨石的铁路由器之后,我写了一个router.js文件并将其放在我的/ client文件夹中,但是我收到的错误是"未捕获的ReferenceError:未定义路由器"

我用chrome devtools检查了错误,它指向我在下面添加的router.js开头的"Router.configure(..."

Router.configure({
layoutTemplate: 'layout',
loadingTemplate: 'loading'
});

Router.map( function () {
//the about route
this.route('about', {
    path: '/about',
    template: 'about',
    action: function () {
        console.log('now routing the about template');
    }
});

this.route('home', {
    path: '/',
    template: 'home',
    action: function () {
        console.log('now routing the home template');
    }
});

//the map route
this.route('map', {
    path: '/map',
    template: 'map',
    action: function () {
        console.log('now routing the map template');
    }

});
});
Run Code Online (Sandbox Code Playgroud)

有谁知道为什么我收到路由器未定义的错误?

meteor iron-router

7
推荐指数
1
解决办法
6808
查看次数

标签 统计

iron-router ×1

meteor ×1