浏览代码

start using vue-router

pull/342/head
Guillaume Vincent 8 年前
父节点
当前提交
2adfa500d1
共有 4 个文件被更改,包括 24 次插入26 次删除
  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 查看文件

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


+ 1
- 26
src/App.vue 查看文件

@@ -93,32 +93,7 @@
<template>
<div id="app">
<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>
</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 查看文件

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

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

+ 20
- 0
src/routes.js 查看文件

@@ -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;

正在加载...
取消
保存