-
Notifications
You must be signed in to change notification settings - Fork 1.1k
UI route
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"
}
}
]
}
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 |
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 |
-
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 -->
The sub routes is specified by the rules.
From | To |
---|---|
home/$key home/$key/index.html home/$key.html |
$valueActivity $valueController |
-
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 -->