0.0.1 • Published 8 years ago

vue-pagejs v0.0.1

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

vue-pagejs

A page.js wrapper for Vue.

An example:

Entry

import vuePage from 'vue-pagejs'
Vue.use(vuePage)

let vm = new Vue({
	components: {App},
})

// may redirect
let authRedirect = ctx => ...

vm.$page('/home', {main: 'home'})
vm.$page(['/', '/sign-in', '/forgot-password'], authRedirect, {main: "auth"})
vm.$page('/', {name: "signup", action: "Sign up"})
vm.$page('/sign-in', {name: "signin", action: "Sign in"})
vm.$page('/forgot-password', {name: "forgotpw", action: "Recover password"})
vm.$page()

vm.$mount("body")

App.vue

<template>
	<component :is="$root.main">
</template>
<script>
	import {Auth, Home} from 'somewhere'
</script>

Plain objects are automatically merged with the data object of the Vue instance when the route is visited.