Similar to the backend Config, EggBornJS also implements the frontend Config at the module level

  1. Module can specify its own configuration
  2. The configuration at project level can override the one at module level

Definition of Config


export default {
  message: 'Hello World',
  markCount: 2,

Usage of Config

Same Module


onPerformClick4() {
  const params = {
    message: this.$config.message,
    markCount: this.$config.markCount,
  return this.$'kitchen-sink/guide/echo4', params).then(data => {
    this.message4 = data;

Across Module

If used across modules, the way is as follows:

this.$meta.module.use('test-party', module => {
  const message = this.$meta.config.modules['test-party'].message;
Name Description
$meta.module.use The frontend of a module is usually loaded asynchronously, so before using the module’s Config, you need to ensure that the module has been loaded
$meta.config.modules[moduleName] Get the Config of the specified module

Override Config

Also can use project level config to override module level config


export default{
  modules: {
    'test-party': {
      message: 'Hello World!',
      markCount: 3,