Skip to content

bopjesvla/vue-pagejs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Releases

No releases published

Packages

No packages published