Microbuild low code has been online “module mixed development” capability.

Users can visually edit the application and enjoy a more complete one-stop development experience by developing the code and deploying the application.

The following will introduce the use scenario and use method of sub-module mixed development in detail.

Application scenarios

Application scenario 1: multi-team development

When developing a large project, it is often not possible for a master development team to complete the development alone. The collaborative scenario of a large project determines the mode of multi-team collaborative development. However, when multiple teams cooperate to develop a project, various problems will be encountered. If not handled properly, problems such as low development efficiency and delayed progress will be caused, which is a major risk point of the project.

Application scenario 2: low code development combined with traditional code development

Some micro link users are not developed from scratch, and will encounter the problem of stock application migration. Sometimes it is difficult to low-code everything in an application due to time issues.

Solution: Mixed development in modules

In view of the above pain points, we can use sub-module mixed development to solve. On the basis of visual editing applications, Tencent Cloud Micro-build Low Code provides a way to develop and deploy applications through code. It has the following advantages:

  • An application can be split into the main module and several sub-modules, module development;
  • The modules are decoupled and relatively independent.
  • Each module supports two development modes: “Low Code Development” and “Upload Code Pack”.
  • After the completion of the development, the micro-build platform will complete the merger, packaging and release, the whole process is convenient and convenient.

Basic concepts:

  • Application main module: Each application must contain a unique application main module. In contrast to submodules, the main module has application-level configuration.
  • Application submodules: Each application can have N submodules, and how they are broken down is based on the developer’s configuration.
  • Low code development mode: Visualize development by micro-matching low code.
  • Upload code package mode: Allows users to upload code packages in traditional development mode.

Note: Only mixed development of small programs is currently supported.

Method of use

The use of mixed development of sub-modules requires a clear master and child relationship. The low code mode of each module is considered as a low code editing application, and the code package is considered as a native applet.

  • Code package as the main module: Make sure that the content is complete small program project code, and the project structure meets the requirements of the system restrictions below. Mount the WEDA APP object in the onLaunch function of app.js (add code, this.app = wedaApp), and after the mount is completed, Subpackages and other modules can get the WEDA App object as const {app} = getApp().
  • Code packages as submodules: Make sure the content is a separate directory of small program applications, that is, the miniProgramRoot directory. The whole project will be placed in the /packages/${subapp.name} path, so the original file references and route jumps that use absolute paths may need to be corrected, and the relative path relationships of the files in the package will not change. Overall, this requires that the final reworked package be a package in the applet subpackage mode, and that an app.json is added to declare the list of pages in the package. For example, the content of app.json in the subpackage sub is:
{
  "pages": [
    "pages/index/index",
    "pages/checkbox/index",
    "pages/switch/index",
    "pages/slider/index"
  ]
}

Finally, the configuration will be added to the completed applet app.json generated:

{
  "subpackages": [
    {
      "root": "packages/sub",
      "pages": [
        "pages/index/index",
        "pages/checkbox/index",
        "pages/switch/index",
        "pages/slider/index"
      ]
    }
  ]
}

Use low code edit main/sub-module: the system will automatically generate the relevant code, without too much concern about the reference relationship, just the business logic of the relationship application itself, the current page jump to jump to the main package page, or sub-package page can be.

Master and submodule interaction

The state of micro-lapped application can be divided into global state and page-level state. The global state is shared by the whole application, while the page-level state is independent for each page. Therefore, when data interaction between master and child modules is needed, the global state should be used for proxy storage. In low code, you can get the app object and assign a global variable to it. In a module of code package type, you can get the app object as const {app} = getApp() to get the/assign variable, and use methods such as data sources.

/pages/${page.id}/index; /pages/${page.id}/index

/ packages / ${subapp. Name} / pages / ${page. Id} / index.

The corresponding template address needs to be specified when handling the route jump.

Note the following restrictions:

  • Each application contains 1 master module and no more than 5 sub-modules. When at least one of the master sub-modules contains a low-code editing type module, a hybrid build can be carried out on a micro-build platform.
  • When the main module is a code package type, it is a complete small program application. After decompressing, the root directory should contain a project.config.json file, in which the miniprogramRoot directory is declared. If not declared, the default directory is the root directory. The root directory contains app.json, app.js, app. WXSS and other application level files. At the same time, Packages, common, app, materials, lowcode are reserved directories, which will generate files required by lowcode in this directory when generating application with lowcode module.
  • When a submodule is a code package type, it must be a separate small program application directory, called MiniProgramRoot. The decompressed root directory contains application-level files such as app.json, whose contents are merged with the low-code generated main module configuration.
  • Application level of low code, variable management, can only be completed in the main application, low code editing class sub-module can be viewed in the editor, but can not be defined declaration and add, delete, change and edit.

Instantly experience microlink low code

https://console.cloud.tencent.com/lowcode/ PC access