smartxworks / sunmao-ui

A Framework for Developing Low-code Tool
https://sunmao-ui.com
Apache License 2.0
1.38k stars 94 forks source link

Support module method #705

Closed tanbowensg closed 1 year ago

tanbowensg commented 1 year ago

how to use?

Add module config in module's spec, like this:

  {
    "kind": "Module",
    "parsedVersion": { "category": "custom/v1", "value": "myModule" },
    "version": "custom/v1",
    "metadata": {
      "name": "myModule0",
      "description": "my module",
      "exampleProperties": {}
    },
    "spec": {
      "stateMap": {},
      "events": [],
      "properties": { "type": "object", "properties": {} },
      "methods": [
        {
          "name": "open",
          "componentId": "modal1",
          "componentMethod": "openModal"
        }
      ]
    },

It works like a proxy. When other components calls open method on ModuleContainer, ModuleRenderer will call modal1's openModal method.

https://user-images.githubusercontent.com/12260952/228761936-f665af4c-7cb6-40e6-8264-d40670d4e110.mov