A component space with mini-program code manager

Methods

  • Add a compiled template

    The content is the execution result of the generated string of the template compiler. The path should not contain the .wxml suffix.

    Parameters

    • path: string
    • content: ComponentTemplate

    Returns void

  • Add a style sheet URL with style scope name

    The URL should be recognized by the target backend. The path should not contain the .wxss suffix.

    Parameters

    • path: string
    • Optional styleSheetUrl: string
    • Optional styleScopeName: string

    Returns void

  • Build a component outside of a definition environment

    The method do not need a definition environment, so the global object pollution is avoided. path should be the component path (without ".js" extension).

    Parameters

    • path: string

    Returns ComponentBuilder<Empty, Empty, Empty, Empty, never, never, never, Empty>

  • Get a compiled template

    The content is the execution result of the generated string of the template compiler. The path should not contain the .wxml suffix.

    Parameters

    • path: string

    Returns undefined | ComponentTemplate

  • Get a style sheet URL

    The URL should be recognized by the target backend. The path should not contain the .wxss suffix.

    Parameters

    • path: string

    Returns undefined | string

  • Create a component definition environment

    During the sync execution of cb , Component and Behavior global vars will be available. globalObject should be the JavaScript global object, a.k.a. window in DOM. Some global variables, a.k.a Component Behavior Page , will be written into globalObject . path should be the component path (without ".js" extension).

    Type Parameters

    • T

    Parameters

    • globalObject: any
    • path: string
    • cb: (() => T)
        • (): T
        • Returns T

    Returns T

  • Import another component space as a plugin (must be in the same environment)

    Components from the imported codeSpace can be used with URLs. If domainAlias is provided, the URL format is plugin://DOMAIN_ALIAS/COMPONENT_SPACE_EXPORT_ALIAS . If privateImport is enabled, another URL format is plugin-private://DOMAIN/COMPONENT_IS .

    Parameters

    • id: string
    • Optional domainAlias: string
    • privateImport: boolean = false

    Returns void