Browse Source

start using vue-router

pull/342/head
Guillaume Vincent 8 years ago
parent
commit
2adfa500d1
4 changed files with 24 additions and 26 deletions
  1. +1
    -0
      package.json
  2. +1
    -26
      src/App.vue
  3. +2
    -0
      src/main.js
  4. +20
    -0
      src/routes.js

+ 1
- 0
package.json View File

@@ -22,6 +22,7 @@
"pilou": "^0.1.4", "pilou": "^0.1.4",
"tether": "^1.3.7", "tether": "^1.3.7",
"vue": "^2.0.1", "vue": "^2.0.1",
"vue-router": "^2.0.0",
"vuex": "^2.0.0" "vuex": "^2.0.0"
}, },
"devDependencies": { "devDependencies": {


+ 1
- 26
src/App.vue View File

@@ -93,32 +93,7 @@
<template> <template>
<div id="app"> <div id="app">
<div id="lesspass" class="card"> <div id="lesspass" class="card">
<login v-show="page === 'login'"></login>
<register v-show="page === 'register'"></register>
<forgot-password v-show="page === 'forgotPassword'"></forgot-password>
<passwords v-show="page === 'passwords'"></passwords>
<password-generator v-show="page === 'index'"></password-generator>
<router-view></router-view>
</div> </div>
</div> </div>
</template> </template>
<script type="text/ecmascript-6">
import PasswordGenerator from './components/PasswordGenerator';
import Login from './components/Login';
import Register from './components/Register';
import ForgotPassword from './components/ForgotPassword';
import Passwords from './components/Passwords';
import {mapGetters} from 'vuex'

export default {
components: {
PasswordGenerator,
Login,
Register,
ForgotPassword,
Passwords,
},
computed: mapGetters([
'page'
])
}
</script>

+ 2
- 0
src/main.js View File

@@ -7,6 +7,7 @@ import LessPass from './App.vue'
import 'bootstrap/dist/js/bootstrap.min'; import 'bootstrap/dist/js/bootstrap.min';
import Store from './store' import Store from './store'
import Storage from './api/storage'; import Storage from './api/storage';
import router from './routes';


const storage = new Storage(); const storage = new Storage();
const store = Store(storage.json()); const store = Store(storage.json());
@@ -14,5 +15,6 @@ const store = Store(storage.json());
new Vue({ new Vue({
el: '#app', el: '#app',
store, store,
router,
render: h => h(LessPass) render: h => h(LessPass)
}); });

+ 20
- 0
src/routes.js View File

@@ -0,0 +1,20 @@
import Vue from 'vue';
import VueRouter from 'vue-router';

import PasswordGenerator from './components/PasswordGenerator';
import Login from './components/Login';
import Register from './components/Register';
import ForgotPassword from './components/ForgotPassword';
import Passwords from './components/Passwords';

Vue.use(VueRouter);

const routes = [
{path: '/', component: PasswordGenerator},
];

const router = new VueRouter({
routes
});

export default router;

Loading…
Cancel
Save