燕鹏
4 years ago
9 changed files with 76 additions and 3 deletions
@ -1,12 +1,20 @@ |
|||||
import Vue from 'vue' |
import Vue from 'vue' |
||||
|
import { RouterFactory, nativeScrollBehavior } from 'meteor/akryum:vue-router2' |
||||
|
|
||||
import '../imports/ui/plugins' |
import '../imports/ui/plugins' |
||||
|
import './routes' |
||||
|
|
||||
import App from '../imports/ui/App.vue' |
import App from '../imports/ui/App.vue' |
||||
|
|
||||
Meteor.startup(() => { |
Meteor.startup(() => { |
||||
|
const routerFactory = new RouterFactory({ |
||||
|
mode: 'history', |
||||
|
scrollBehavior: nativeScrollBehavior, |
||||
|
}) |
||||
|
const router = routerFactory.create() |
||||
new Vue({ |
new Vue({ |
||||
el: '#app', |
el: '#app', |
||||
|
router: router, |
||||
...App, |
...App, |
||||
}) |
}) |
||||
}) |
}) |
||||
|
@ -0,0 +1,21 @@ |
|||||
|
// Import the router
|
||||
|
import { RouterFactory } from 'meteor/akryum:vue-router2' |
||||
|
|
||||
|
// Components
|
||||
|
import Home from '/imports/ui/views/Home' |
||||
|
import Page from '/imports/ui/views/Page.vue' |
||||
|
|
||||
|
RouterFactory.configure(factory => { |
||||
|
factory.addRoutes([ |
||||
|
{ |
||||
|
path: '/', |
||||
|
name: 'home', |
||||
|
component: Home, |
||||
|
}, |
||||
|
{ |
||||
|
path: '/page', |
||||
|
name: 'page', |
||||
|
component: Page, |
||||
|
}, |
||||
|
]) |
||||
|
}) |
@ -0,0 +1,15 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
home |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: "Home" |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
@ -0,0 +1,15 @@ |
|||||
|
<template> |
||||
|
<div> |
||||
|
page |
||||
|
</div> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
export default { |
||||
|
name: "Page" |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style scoped> |
||||
|
|
||||
|
</style> |
Loading…
Reference in new issue