Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

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

...

  1. layout('user'): Return a layout function for user

  2. layout('user')('login_title_before'): Return a layout function for user.login_title_before. It equals to layout('user.login_title_before')

  3. layout('user')('login_title_before')(): Return a function config of layout, it will receive config from plugin (module)

  4. 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: Thêm 1 dòng total vào trong total của order detail , có nội dung là Total Added: 0Add new total line in total of order detail, with label “Total Fee”, amount is ‘$0’