Commit ce0c9be8a52509e9307a5313b59a5e29d42eab97
1 parent
e241b258
企业
Showing
3 changed files
with
43 additions
and
4 deletions
webintroduce/src/router/index.js
... | ... | @@ -2,6 +2,7 @@ import Vue from 'vue' |
2 | 2 | import Router from 'vue-router' |
3 | 3 | import VHome from '../views/VHome' |
4 | 4 | const VSolution = () => import('../views/VSolution') |
5 | +const VEnterprise = () => import('../views/VEnterprise') | |
5 | 6 | |
6 | 7 | Vue.use(Router) |
7 | 8 | |
... | ... | @@ -14,13 +15,18 @@ export default new Router({ |
14 | 15 | }, |
15 | 16 | { |
16 | 17 | path: '/home', |
17 | - name: 'VHome', | |
18 | + name: 'home', | |
18 | 19 | component: VHome |
19 | 20 | }, |
20 | 21 | { |
21 | 22 | path: '/solution', |
22 | - name: 'VSolution', | |
23 | + name: 'solution', | |
23 | 24 | component: VSolution |
24 | 25 | }, |
26 | + { | |
27 | + path: '/enterprise/:id', | |
28 | + name: 'enterprise', | |
29 | + component: VEnterprise | |
30 | + } | |
25 | 31 | ] |
26 | 32 | }) | ... | ... |
webintroduce/src/views/VEnterprise.vue
0 → 100644
webintroduce/src/views/VHome.vue
1 | 1 | <template> |
2 | - <div>home</div> | |
2 | + <ul> | |
3 | + <li v-for="(enterprise,index) in enterprises" | |
4 | + :key="index" @click="toEnterprise(enterprise.id)"> | |
5 | + {{enterprise.name}} | |
6 | + </li> | |
7 | + </ul> | |
3 | 8 | </template> |
4 | 9 | |
5 | 10 | <script> |
6 | 11 | export default { |
7 | - name: 'VHome' | |
12 | + name: 'VHome', | |
13 | + data(){ | |
14 | + return { | |
15 | + enterprises:[ | |
16 | + {name:'企业1',id:1}, | |
17 | + {name:'企业2',id:2}, | |
18 | + {name:'企业3',id:3}, | |
19 | + ] | |
20 | + } | |
21 | + }, | |
22 | + methods: { | |
23 | + toEnterprise(id){ | |
24 | + console.log(id) | |
25 | + this.$router.push({name:'enterprise',params:{id:id}}) | |
26 | + } | |
27 | + } | |
8 | 28 | } |
9 | 29 | </script> |
10 | 30 | ... | ... |