1.0.0 • Published 8 years ago

vue-simple-router v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
8 years ago

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.

1.0.0

8 years ago

0.1.11

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.1

8 years ago