vue-simple-router
Vue router for Non-Single-Page applications.
Last updated 5 years ago by kchan .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install vue-simple-router 
SYNC missed versions from official npm registry.

vue-simple-router

In fact, it's not simple at all, it's just made for Non-Single-Page applications.

Installation

npm install vue-simple-router --save-dev

Example

import router from 'vue-simple-router';

// define a view for homepage:
// first define a footer element:
const footer = {
  el: '#footer',
  data () {
    return { year: 2015 };
  }
};
const home = {
  data () {
    return { siteName: 'Home' };
  },
  kids: [footer],
  // It works with `Webpack` and `Vue-loader`
  // which means you can write single-file Vue component and use it in Vue Simple Router.
  components: {
    clock: require('./components/clock.vue')
  }
};

// use a plugin, like vue-resource
router.use(VueResource);
// or
router.Vue.use(VueResource);

// map routes, support /user/* style minimatch
router.reg('/home*', {
  view: home
});
// or Regex
router.reg(/^\/home$/, {
  view: home
});

// initial router and bind it to body
router.init();
// or bind to anywhere
router.init('#app');

// alias routes
router.alias('/u/sox', '/user/egoist');
// support minimatch too
router.alias('/u/*', '/user/egoist');

License

MIT © EGOIST.

Current Tags

  • 1.0.0                                ...           latest (5 years ago)

9 Versions

  • 1.0.0                                ...           5 years ago
  • 0.1.11                                ...           5 years ago
  • 0.1.1                                ...           5 years ago
  • 0.1.0                                ...           5 years ago
  • 0.0.14                                ...           5 years ago
  • 0.0.13                                ...           5 years ago
  • 0.0.12                                ...           5 years ago
  • 0.0.11                                ...           5 years ago
  • 0.0.1                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 0
Dependencies (2)
Dev Dependencies (8)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |