0.0.1 • Published 2 years ago

@hippy/vue-router-next-history v0.0.1

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

vue-router-next-history

This is a hippy history mode for @hippy/vue-next. We copy source code from memory mode for vue-router and make a small change. Current history position was exported to be access outside for other purpose.

And we will inject android hardware back press to execute router back by default. only exit app when there is no history back.

How To Use

  1. Install
# you should install @hippy/vue-next and vue-router first
npm install @hippy/vue-router-next-history --save-dev
  1. Use
// we used typescript
import type { Router } from 'vue-router';
import { createHippyRouter } from '@hippy/vue-router-next-history';
import App from './app.vue';

const routes = [
  {
    path: '/',
    component: App,
  },
  {
    path: '/path',
    component: App,
  }
];

const router: Router = createHippyRouter({
  routes,
});


router.push('/');
router.push('/path');

// now if you press android hardware back, it should back to path '/' first. then exit
// app at the second press