我已经添加了铁路由器到我的应用程序来处理主页,关于页面和应用程序的主页面之间的路由,这是一张地图
在添加了带有陨石的铁路由器之后,我写了一个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)
有谁知道为什么我收到路由器未定义的错误?