...
A module can add UI to screen/page via layout mechanism, it works like event.
Customize Point
In a component, we should use layout to allow other module can add UI
...
layout('user')
: Return a layout function foruser
layout('user')('login_title_before')
: Return a layout function foruser.login_title_before
. It equals tolayout('user.login_title_before')
layout('user')('login_title_before')()
: Return a function config of layout, it will receive config from plugin (module)layout('user')('login_title_before')()(this)
: Call layout plugin with param (this)
Plugin to add customize
In the module, we register a layout customize in file etc/config.js
.
...
For more case, please view files src/framework/Layout.js
and src/framework/__tests__/Layout-test.js
Exercise: Add new total line in total of order detail, with label “Total Fee”, amount is ‘$0’