Giter Club home page Giter Club logo

lcui-router's Introduction

lcui-router

(English/δΈ­ζ–‡)

GitHub Actions Build Status Coverage Status

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

Installation

Windows:

Install with LCPkg:

lcpkg install github.com/lc-soft/lcui-router

Linux:

Download source code and copy it to your project directory.

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.

License

MIT licensed.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.