声明组件参数(道具)
class Hello < Hyperloop::Component
# params (= react props) are declared using the param macro
param :guest
render do
"Hello there #{params.guest}"
end
end
# to "mount" Hello with guest = "Matz" say
Hello(guest: 'Matz')
# params can be given a default value:
param guest: 'friend' # or
param :guest, default: 'friend'