流量路由器SSR参数错误
问题描述:
我想获得的URL参数与我SSR流量路由器流量路由器SSR参数错误
FlowRouter.route("/:lang", {
name: "home",
action({lang}) {
console.log(lang);
mount(MainLayout, {
content:() => (<Home/>)
});
}
});
我不知道为什么,但我得到的路线这个错误http://localhost:3000/testparam
Error when doing SSR. path:/testparam: Expected "lang" to be defined
带有“testparam”的我的console.log出现在服务器端控制台上的错误之前。
编辑: 在客户侧的错误也出现:
Uncaught TypeError: Expected "lang" to be defined
答
我觉得{}郎是不正确的。尝试
action(params) { console.log(params.lang) }
这里它采用SSR路由器我的演示的一个例子:
https://github.com/LucaMele/meteor-react-ssr-app-demo/blob/master/lib/routing.js
它是否也发生没有SSR? – aedm