我收到了“Uncaught error:RuntimeError:Edit似乎不是反应组件。”消息,尽管在同一模块中定义了编辑:
module Components
module Admin
module Discounts
class Layout < Hyperloop::Router::Component
render(DIV) do
Switch do
Route("#{match.url}/index") do
Redirect(pathname: match.url, search: location.search)
end
Route(match.url, exact: true) do |m, l, h|
Index(match: m, location: l, history: h)
end
Route("#{match.url}/:discount_id/edit") do |m, l, h|
Edit(match: m, location: l, history: h)
end
Route("#{match.url}/new") do |m, l, h|
New(match: m, location: l, history: h)
end
end
end
end
end
end
end
module Components
module Admin
module Discounts
class Edit < Hyperloop::Router::Component
...
但是,我有另一个文件models / edit.rb,似乎是用来代替
module Edit
def backup(attr_whitelist, assoc_whitelist)
@saved_attributes = attributes_as_json(attr_whitelist, assoc_whitelist)
end
有关为什么会发生这种情况的想法/如何指向类Edit?
看起来你发现了一个错误!
https://github.com/hyperstack-org/hyperstack/issues/181
它是模糊的,但如果组件类是嵌套的,并且在外部作用域中定义了另一个模块或类,则组件查找失败!
同时你可以
Discount::Edit
)组件名称