Updated on 2025-03-24 GMT+08:00

eventConfig

Field Description

The eventConfig is a widget event configuration item, which is used to define the variable structure exposed by the widget event and the service meanings of the event and the transmitted variables. After the eventConfig is configured, the itemVal of the event can be transferred to the page global variable for other widgets to use during widget configuration interaction.

Typical Example

A typical eventConfig example is as follows:

// Widget event configuration item, which defines the widget event structure and description for global variable mapping.
eventConfig: {
    clickSeries: {
      desc: { zh_CN: 'Click Series', en_US: 'Click Series' },
      fields: [
        {
          name: 'seriesIndex',
          desc: { zh_CN: 'Series Index', en_US: 'Series Index' },
        },
        {
          name: 'seriesName',
          desc: { zh_CN: 'Series Name', en_US: 'Series Name' },
        },
      ],
    },
  },
The clickSeries field corresponds to the event ID registered in the {widget}.js file.
window.Studio.registerEvents(this, 'clickSeries', { 
    zh_CN: 'Click Series', en_US: 'Click Series' 
});

In the clickSeries object, desc is the explanation of the selectItem event. fields indicates the field and description of the widget. The corresponding code must be implemented in the {widget}.js file as follows:

this.echartsInst.on('click', 'series', (event) => {
     thisObj.triggerEvent('clickSeries', event);
});