3.3.2 • Published 2 years ago

@voyom/vue-router v3.3.2

Weekly downloads
-
License
ISC
Repository
-
Last release
2 years ago

voyo-micro vue-router

About

Routing configuration loaded by micro-module.

Expend the vue-router(^v3.0).

Install

npm i @voyom/vue-router

Usage

main.ts
import { VoyoRouterMain} from "@voyom/vue-router";
import {createRouter} from "vue-router"; 

const voyoRouterMain=new VoyoRouterMain({
  routes:[
    {
      path:"/a",component:A
    },
    {
      path:"/module-a",
      module:()=>import("a.module")
    }
  ]
});

const vueRouter=createRouter({
  routes:[]
});

voyoRouterMain.mount(vueRouter);
a.module.ts
import {VoyoRouterChild} from "@voyom/vue-router";


export default new VoyoRouterChild({
  routes: [
    {
      path: "c",component: C
    },
    { 
      path: "d",
      module: ()=>import("a-child.module") //Load A deeper module.
    },
  ],
})

Cache Router

import { VoyoRouterView, routerChangeService } from "@voyom/vue-router";

routerChangeService.routerMode = "hash"; // "hash" | "history" ;
Vue.component("voyo-router-view",VoyoRouterView);

As the page forward , the old page is automatically pushed into the cache.

When returned, the current page is destroyed, the cached page is automatically restored.

Page component will have new life hooks,when you use voyo-router-view:

  • onShow() When page is visible.
  • onHide() page hidden

restore scroll position

  1. Restore body scrollPosition (pc)
  2. Each page has its own scroll-view (mobile). scroll-view restore scrollPosition when connectedCallback() or activated() callback;
3.3.1

2 years ago

3.3.2

2 years ago

3.3.0

3 years ago

3.2.0

3 years ago

3.1.2

3 years ago

3.1.1

3 years ago

3.1.0

3 years ago

3.0.0-alpha.2

3 years ago

3.0.0-alpha.1

3 years ago

1.0.0

3 years ago

0.0.1-alpha.2

3 years ago

0.0.1-alpha.1

3 years ago