Skip to content
galen edited this page Dec 7, 2015 · 9 revisions

Small use bundles.json file to configure UI routes.

Example:

{
  "version": "1.0.0",
  "bundles": [
    {
      "uri": "home",
      "pkg": ".bundle.home",
      "rules": {
        "page1": "MyPage1",
        "page2": "MyPage2"
      }
    }
  ]
}

Main route

The main route is composed of the uri and the pkg. The pkg is the package id of the bundle.

From To
home
home/index.html
home.html
Bundle entrance

Bundle entrance

The default page or the principal class of the bundle.

Bundle type Default page Example
Android The launcher activity registered in AndroidManifest.xml
iOS The same name controller with the bundle id's last component id: *.bundle.home
entrance: HomeController
Web index.html

Usage

  • Android

    Small.openUri("home", context); // Turn to *.bundle.home.MainActivity (1)
  • iOS

    [Small openUri:@"home" fromController:controller]; // Turn to *.bundle.home.HomeController (2)
  • Web

    <a href="http://m.wequick.net/demo/home">home</a> <!-- Turn to (1) or (2) by current device -->

Sub routes

The sub routes is specified by the rules.

From To
home/$key
home/$key/index.html
home/$key.html
$valueActivity
$valueController

Usage

  • Android

    Small.openUri("home/page1", context); // Turn to *.bundle.home.MyPage1Activity (1)
  • iOS

    [Small openUri:@"home/page1" fromController:controller]; // Turn to *.bundle.home.MyPage1Controller (2)
  • Web

    <a href="http://m.wequick.net/demo/home/page1">page1</a> <!-- Turn to (1) or (2) by current device -->