diff --git a/20_脚手架/vue_code/31.src_路由的params参数/App.vue b/20_脚手架/vue_code/31.src_路由的params参数/App.vue new file mode 100644 index 0000000..5b3cab5 --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/App.vue @@ -0,0 +1,32 @@ + + + diff --git a/20_脚手架/vue_code/31.src_路由的params参数/assets/logo.png b/20_脚手架/vue_code/31.src_路由的params参数/assets/logo.png new file mode 100644 index 0000000..f3d2503 Binary files /dev/null and b/20_脚手架/vue_code/31.src_路由的params参数/assets/logo.png differ diff --git a/20_脚手架/vue_code/31.src_路由的params参数/components/Banner.vue b/20_脚手架/vue_code/31.src_路由的params参数/components/Banner.vue new file mode 100644 index 0000000..ea3040a --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/components/Banner.vue @@ -0,0 +1,11 @@ + + + diff --git a/20_脚手架/vue_code/31.src_路由的params参数/main.js b/20_脚手架/vue_code/31.src_路由的params参数/main.js new file mode 100644 index 0000000..9c406ac --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/main.js @@ -0,0 +1,23 @@ +// 引入Vue +import Vue from "vue"; +// 引入App +import App from "./App"; +// 引入VueRouter +import VueRouter from "vue-router"; +// 引入router +import router from "@/router"; + +// 设置Vue +Vue.config.productionTip = false + +// 使用插件 +Vue.use(VueRouter) + +// 实例化Vue +new Vue({ + components: { + App + }, + render: h => h(App), + router: router, +}).$mount('#app') diff --git a/20_脚手架/vue_code/31.src_路由的params参数/pages/About.vue b/20_脚手架/vue_code/31.src_路由的params参数/pages/About.vue new file mode 100644 index 0000000..26560f1 --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/pages/About.vue @@ -0,0 +1,21 @@ + + + + + \ No newline at end of file diff --git a/20_脚手架/vue_code/31.src_路由的params参数/pages/Detail.vue b/20_脚手架/vue_code/31.src_路由的params参数/pages/Detail.vue new file mode 100644 index 0000000..ad59324 --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/pages/Detail.vue @@ -0,0 +1,16 @@ + + + diff --git a/20_脚手架/vue_code/31.src_路由的params参数/pages/Home.vue b/20_脚手架/vue_code/31.src_路由的params参数/pages/Home.vue new file mode 100644 index 0000000..f40e1c1 --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/pages/Home.vue @@ -0,0 +1,36 @@ + + + + + \ No newline at end of file diff --git a/20_脚手架/vue_code/31.src_路由的params参数/pages/Message.vue b/20_脚手架/vue_code/31.src_路由的params参数/pages/Message.vue new file mode 100644 index 0000000..43e8bf4 --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/pages/Message.vue @@ -0,0 +1,45 @@ + + + diff --git a/20_脚手架/vue_code/31.src_路由的params参数/pages/News.vue b/20_脚手架/vue_code/31.src_路由的params参数/pages/News.vue new file mode 100644 index 0000000..a8d4f7b --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/pages/News.vue @@ -0,0 +1,15 @@ + + + diff --git a/20_脚手架/vue_code/31.src_路由的params参数/router/index.js b/20_脚手架/vue_code/31.src_路由的params参数/router/index.js new file mode 100644 index 0000000..f086b0c --- /dev/null +++ b/20_脚手架/vue_code/31.src_路由的params参数/router/index.js @@ -0,0 +1,40 @@ +import VueRouter from "vue-router"; + +// 引入组件 +import About from "@/pages/About.vue" +import Home from "@/pages/Home.vue" +import News from "@/pages/News.vue" +import Message from "@/pages/Message.vue"; +import Detail from "@/pages/Detail.vue"; + +// 创建一个路由器 +export default new VueRouter({ + routes: [ + { + name: 'guanyu', + path: '/about', + component: About + }, + { + path: '/home', + component: Home, + children: [ + { + path: 'news', + component: News, + }, + { + path: 'message', + component: Message, + children: [ + { + name: 'xiangqing', + path: 'detail/:id/:title', + component: Detail + } + ] + } + ] + }, + ] +}) diff --git a/20_脚手架/vue_code/src/pages/Detail.vue b/20_脚手架/vue_code/src/pages/Detail.vue index 22f2d00..ad59324 100644 --- a/20_脚手架/vue_code/src/pages/Detail.vue +++ b/20_脚手架/vue_code/src/pages/Detail.vue @@ -1,7 +1,7 @@ diff --git a/20_脚手架/vue_code/src/pages/Message.vue b/20_脚手架/vue_code/src/pages/Message.vue index 1e5ac53..43e8bf4 100644 --- a/20_脚手架/vue_code/src/pages/Message.vue +++ b/20_脚手架/vue_code/src/pages/Message.vue @@ -3,18 +3,18 @@
diff --git a/20_脚手架/vue_code/src/router/index.js b/20_脚手架/vue_code/src/router/index.js index f49ce2c..f086b0c 100644 --- a/20_脚手架/vue_code/src/router/index.js +++ b/20_脚手架/vue_code/src/router/index.js @@ -29,7 +29,7 @@ export default new VueRouter({ children: [ { name: 'xiangqing', - path: 'detail', + path: 'detail/:id/:title', component: Detail } ]