Page routing

更新时间:
复制 MD 格式

Page routing is the foundation for navigating application pages in the Mobi low-code development platform. The routing mechanism allows users to directly access specific application pages through a URL, providing an efficient way to switch between pages. This document explains how to manage page routes on the Mobi platform and how to use routing information to improve application navigation.

Routing features

Uniqueness

Each page in an application has a unique route address that corresponds to only one page. This ensures that the application loads the correct page when a user enters a specific route.

Single-layer routing

Mobi supports single-layer routing. This means all page routes are in the root directory of the application. This simplifies the route structure and makes routes easier to manage and understand.

Using routes

Configure a route

When you create a page, a default route is assigned. The default route is the page name with a `/` prefix. You can modify a route by double-clicking the route of the corresponding page under **Pages & Layouts**.

Access a page by URL

You can directly access a page by entering the application's URL followed by the page route in the browser's address bar. For example, if the base URL of the application is https://app.example.com/app/app123456 and the page route is /dashboard, the full URL is https://app.example.com/app/app123456/dashboard.

Get route information

You can use the mobi.URL object provided by Mobi to retrieve route information for the current page. This information includes query parameters and the hash. You can use this information to execute specific logic based on URL changes, such as filtering a list or navigating to a specific part of a page.

For more information about the API, see API Reference - URL.

Notes

  • Because of the limitations of single-layer routing, plan your application's page structure and navigation flow carefully.

  • When you use route information for page logic, ensure that the logic is robust. For example, handle cases where query parameters or hash values do not exist.