【发布时间】:2017-03-21 19:53:50
【问题描述】:
riot.route('/*', function(category) {
riot.mount('#main', 'category-page', category)
})
当 URL 更改时,我想将参数作为“类别”并在 <category-page> 中使用它。
我试过console.log(this.opts.category)in <category-page>,但我得到的是未定义的。
riot.route('/*', function(category) {
riot.mount('#main', 'category-page', category)
console.log(category)
})
当我像上面那样编码时,console.log(category) 运行良好。所以我认为传递或获取参数是错误的。我尝试了很多案例,但我无法解决它。
请帮我解决这个问题。
【问题讨论】:
标签: javascript riot.js riot