mirror of
https://github.com/lc-soft/LCUI.git
synced 2026-12-01 16:56:34 +01:00
- charset module renamed to encoding (decode/encode kept)
- time: get_time_ms → y_gettime, sleep_ms → y_sleep
- time: delete get_time_us, get_time_delta, sleep_s
- string: strdup2 → y_strdup, wcsdup2 → y_wcsdup
- string: strtolower → y_strlower, strtrim → y_strtrim
- string: wcstrim → y_wcstrim, strhash → y_strhash
- string: strreplace → y_strreplace, strsplit → y_strsplit
- string: delete wcsreplace, cmdsplit
- math: delete y_iround, y_pow2
- timer module migrated from yutil to ptk as internal timer_scheduler
- WinMain simplified to use __argc/__argv instead of cmdsplit
BREAKING CHANGE: all renamed yutil public APIs require downstream
to update function names. Deleted APIs require code changes:
- get_time_us: use y_gettime() for ms timestamps
- get_time_delta: use y_gettime() - start instead
- sleep_s: use y_sleep(ms) with millisecond argument
- wcsreplace: no replacement, had zero callers
- cmdsplit: WinMain now uses __argc/__argv from CRT
- timer_list_*: migrated to ptk timer_scheduler_*;
ptk_reset_timer still available for external use
lcui-router
(English/中文)
Introduction
LCUI Router is the official router for LCUI. It provides a similar development experience to the Vue Router and make building multiple views applications with LCUI a breeze. Features include:
- Nested route/view mapping
- Modular, component-based router configuration
- Route params, query, wildcards
- Fine-grained navigation control
- Links with automatic active CSS classes
Getting Started
Note: We will using lcui-cli tool to manage the configuration and source code for the router.
Create an LCUI application project:
lcui create myapp
cd myapp
Overwrite the following code to the file app/assets/views/app.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<lcui-app>
<resource type="text/css" src="assets/stylesheets/app.css"/>
<ui>
<w>
<textview>Hello App!</textview>
<w>
<!-- use router-link component for navigation. -->
<!-- specify the link by passing the `to` prop. -->
<router-link to="/foo">Go to Foo</router-link>
<router-link to="/bar">Go to Bar</router-link>
</w>
<!-- route outlet -->
<!-- component matched by the route will render here -->
<router-view />
</w>
</ui>
</lcui-app>
Generate two widgets:
lcui generate widget foo
lcui generate widget bar
Save following code as file config/router.js:
module.exports = [
{ path: '/foo', component: 'foo' },
{ path: '/bar', component: 'bar' }
]
Compile config file for router:
lcui compile router
Run app:
lcpkg run start
For more examples, please see the lcui-router-app project.
Documentation
LCUI Router is referenced from Vue Router, so you can read the Vue Router documentation to learn about the basic usage of LCUI Router.