如何在 Hyperstack 中启用参数作为方法
How do I enable params as methods in Hyperstack
我想使用:
class UserDetails < HyperComponent
param :user
render do
H1 { user.name }
end
而不是
class UserDetails < HyperComponent
param :user
render do
H1 { @User.name }
end
如何将其设为默认值?
class HyperComponent
include Hyperstack::Component
include Hyperstack::State::Observable
param_accessor_style :accessors # this is now the prefered param style
end
我想使用:
class UserDetails < HyperComponent
param :user
render do
H1 { user.name }
end
而不是
class UserDetails < HyperComponent
param :user
render do
H1 { @User.name }
end
如何将其设为默认值?
class HyperComponent
include Hyperstack::Component
include Hyperstack::State::Observable
param_accessor_style :accessors # this is now the prefered param style
end