Skip to content

Shell container

Shell is the page container of the mini program runtime. It is responsible for building the complete UI framework structure.

Structure

┌──────────────────────────────────┐
│           StatusBar              │  系统状态栏
├──────────────────────────────────┤
│           NavBar                 │  导航栏(标题、返回)
├──────────────────────────────────┤
│                                  │
│                                  │
│          Content Area            │  页面内容区域
│        (开发者页面)             │  (webview 渲染)
│                                  │
│                                  │
├──────────────────────────────────┤
│           TabBar                 │  底部标签栏(可选)
└──────────────────────────────────┘

Shell HTML generation

Shell is generated at build time by the minidev-shell package. The core function generateShellHtml() produces the full HTML structure from app.json configuration:

minidev-shell/index.js
  → generateShellHtml(appConfig)
    → NavBar HTML
    → Content Container
    → TabBar HTML(如果配置了 tabBar)
    → StatusBar HTML
    → 注入 runtime-src.js(运行时逻辑)
    → 注入 minidev-components(Web Components)

runtime-src.js

The shell runtime core is responsible for:

  1. Event listening — listens for Bridge events via setupBridge()
  2. UI rendering — creates/updates the DOM when events are received
  3. Callback delivery — user interaction results are sent back via sendCallback()
  4. Tab grouping — manages activeGroup state and handles tab group switching

Supported events

EventRender behavior
UI.showLoadingCreates a Loading overlay
UI.hideLoadingRemoves the Loading overlay
UI.showToastCreates a Toast
UI.hideToastRemoves the Toast
UI.showDialogCreates a Dialog and waits for the callback
UI.alertCreates an Alert and waits for the callback
UI.showActionSheetCreates an ActionSheet and waits for the callback
UI.setNavigationBarTitleUpdates NavBar title text
UI.setNavigationBarColorUpdates NavBar colors
UI.showNavigationBarLoadingShows loading animation on the NavBar
UI.hideNavigationBarLoadingHides loading animation on the NavBar
UI.showTabBar / hideTabBarShow/hide the TabBar
UI.setTabBarBadgeSets a tab badge
UI.setTabBarItemUpdates a tab item
UI.setTabBarStyleUpdates TabBar styles
Router.setActiveGroupSwitches tab group

Configuring shell styles

Configure global styles via the window field in app.json:

json
{
  "window": {
    "navigationBarTitleText": "我的应用",
    "navigationBarBackgroundColor": "#ffffff",
    "navigationBarTextStyle": "black",
    "backgroundColor": "#f5f5f5"
  }
}
FieldDescriptionDefault
navigationBarTitleTextNavBar title
navigationBarBackgroundColorNavBar background color#ffffff
navigationBarTextStyleNavBar text colorblack
backgroundColorPage background color#ffffff

MiniDev Studio — Mini-app Development Toolkit