riot.route('/*', function(category) {
riot.mount('#main', 'category-page', category)
})
当 URL 更改时,我想将参数作为“类别”并在<category-page>
. 我试过console.log(this.opts.category)
了<category-page>
,但我得到的是未定义的。
riot.route('/*', function(category) {
riot.mount('#main', 'category-page', category)
console.log(category)
})
当我像上面那样编码时,console.log(category)
效果很好。所以我认为传递或获取参数是错误的。我尝试了很多案例,但我无法解决它。请帮我解决这个问题。