update
This commit is contained in:
@@ -65,3 +65,52 @@ new Vue({
|
||||
```
|
||||
|
||||
全部代码:
|
||||
|
||||
app.vue
|
||||
|
||||
```
|
||||
<template>
|
||||
<div id="app">
|
||||
<router-view></router-view>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
|
||||
</script>
|
||||
|
||||
<style>
|
||||
</style>
|
||||
|
||||
|
||||
```
|
||||
main.js
|
||||
|
||||
```
|
||||
import Vue from 'vue'
|
||||
import App from './App.vue'
|
||||
import VueRouter from 'vue-router'
|
||||
import aa from "./components/a.vue";
|
||||
import bb from "./components/b.vue";
|
||||
Vue.use(VueRouter)
|
||||
Vue.config.productionTip = false
|
||||
|
||||
const routes= [
|
||||
{ path: "/a", component: aa },
|
||||
{ path: "/b", component: bb },
|
||||
|
||||
]
|
||||
const router = new VueRouter({
|
||||
routes // (缩写) 相当于 routes: routes
|
||||
})
|
||||
|
||||
new Vue({
|
||||
el: '#app',
|
||||
router,
|
||||
render: h => h(App)
|
||||
})
|
||||
|
||||
|
||||
```
|
||||
|
||||
a.
|
||||
Reference in New Issue
Block a user