All Products
Search
Document Center

SuperApp:Use the scaffolding for miniapps

Last Updated:Oct 25, 2024

The scaffolding provided by Superapp allows you to directly compile and develop WindVane miniapps. The scaffolding for miniapps helps you better understand the code structure of miniapps and quickly start developing your miniapps. This topic describes how to use the scaffolding for WindVane miniapps in Visual Studio Code.

Prerequisites

The latest versions of Visual Studio Code and Node are downloaded and installed.

Initialize the scaffolding

  1. Click the 截屏2022-12-30 下午4 icon in the sidebar of Visual Studio Code, and then click Create Miniapp in the current window. A template selection page appears.

    截屏2023-06-19 14.png

  2. Select a template for creating a miniapp on the page. The Visual Studio Code extension for WindVane provides seven built-in templates, including six templates that use mainstream frameworks such as React, Vue, and Angular, and a template that does not use any framework.

    截屏2023-06-19 14.png

  3. After you select a template, the file save dialog box of the system appears. The following figure shows the dialog box in the macOS system. In the dialog box, specify an app name, select the storage directory, and then click Create to initialize the scaffolding project.

    截屏2022-11-26 下午5

    After the initialization is complete, the Visual Studio Code extension for WindVane automatically opens the scaffolding project.

    Run the npm install command to add project dependencies. The following figure shows the project directory after the project dependencies are added.

    image

    • public contains public resources of the project.

    • scripts contains the build scripts.

    • src contains source files of the project. It consists of the following subdirectories and files:

      • assets: stores images such as the logo file.

      • components: stores component files.

      • index.js: the entry file for the project.

    • package.json is the configuration file of the project.

    • node_modules contains the project dependency modules loaded by the npm command.

    • dist is generated after the project is packaged by running the npm run build command.

Integrate JavaScript APIs

Note

The Visual Studio Code extension for WindVane allows you to quickly integrate JavaScript APIs based on code hinting (IntelliSense). For more information about JavaScript APIs, see JavaScript APIs.

  1. In the Visual Studio Code extension for WindVane, IntelliSense is available for code related to WindVane JavaScript APIs. If you enter WV in a .js or .ts file, the relevant APIs are displayed.image

  2. After you select a JavaScript API, the relevant code snippet is directly inserted to integrate the API.

    image