diff --git "a/\345\210\230\346\263\242/2021-6-15.md" "b/\345\210\230\346\263\242/2021-6-15.md" new file mode 100644 index 0000000000000000000000000000000000000000..a7f7bd62d4b199f4bccfda51b5c64058dc60c947 --- /dev/null +++ "b/\345\210\230\346\263\242/2021-6-15.md" @@ -0,0 +1,19 @@ +# Vue的第十三天 +* 路由的安装yarn add vue-router +* 在main.js文件中用import VueRouter from 'vue-router'引用模块 +* Vue.use(VueRouter)使用 +* 引入模板文件 +``` +import Text from './components/Text' + +let router = new VueRouter({ + mode:'history', + routes:[ + { + path:'/text', //路径 + component:Text //文件 + } + ] +}) +``` +* 在app.vue中使用开启接口 \ No newline at end of file diff --git "a/\345\210\230\346\263\242/2021-6-16.md" "b/\345\210\230\346\263\242/2021-6-16.md" new file mode 100644 index 0000000000000000000000000000000000000000..03b2f55c423f336f8c4d1be84e55ece11f0e9b9f --- /dev/null +++ "b/\345\210\230\346\263\242/2021-6-16.md" @@ -0,0 +1,34 @@ +# Vue的第十四天 +* 动态路由可以在路由中对网页进行传值 +* 设置了动态路由必须进行传值不然无法展示页面 +``` +//main.js文件在路由中设置 +let router = new VueRouter({ + mode:'history', + routes:[ + { + path:'/text/:id', + component:Text + } + ] +}) +``` +* 嵌套路由设置子页面 +``` +let router = new VueRouter({ + mode:'history', + routes:[ + { + path:'/text', + component:Text, + children:[ + { + path:"bedlam", + component:Bedlams + } + ] + } + ] +}) +``` +* 在父页面设置接入子页面内容 \ No newline at end of file diff --git "a/\345\210\230\346\263\242/2021-6-18.md" "b/\345\210\230\346\263\242/2021-6-18.md" new file mode 100644 index 0000000000000000000000000000000000000000..a32cc7b175daf7091d0b6c00bfdf41a471d6cfd9 --- /dev/null +++ "b/\345\210\230\346\263\242/2021-6-18.md" @@ -0,0 +1,46 @@ +# Vue的第十五天 +* 可以在各个vue组件当中设置钩子跳转到设定路由页面 +``` + + + +``` +* 命名路由 +``` +let router = new VueRouter({ + mode:'history', + routes:[ + { + path:'/zoo', + name:'Zoo', + component:Zoo + } + ] +}) +``` +* 还可以传输参数,使用name时可以用params使用path时params会被忽略要用query +``` +mounted: function () { + setTimeout(() => { + this.$router.push({ name: "zoo", params: { say: "来看猴子啦" } }); + }, 2000); + } +``` +* {{$route.params.say}}可以吧传输的值显示出来在目标页面 diff --git "a/\345\210\230\346\263\242/2021-6-19.md" "b/\345\210\230\346\263\242/2021-6-19.md" new file mode 100644 index 0000000000000000000000000000000000000000..15dc45ab1d729d71cfd39e48d22986842024defc --- /dev/null +++ "b/\345\210\230\346\263\242/2021-6-19.md" @@ -0,0 +1,40 @@ +# vue的第十六天 +* 命名视图在main中定义视图对应名称在app中使用视图名称 +``` + + +let router = new VueRouter({ + mode:'history', + routes:[ + { + path:'/zoo', + name:'Zoo', + components:{ + Zoo:Zoo + } + } + ] +}) +``` +* 嵌套名视图如果只有一个视图接口会选择default命名的视图 +``` +let router = new VueRouter({ + mode: 'history', + routes: [ + { + path: '/zoo', + component: Zoo, + children:[ + { + path:'animal', + components:{ + Animal:Animal, + default:Monkey, + } + } + ] + } + ] + +}); +``` \ No newline at end of file diff --git "a/\345\210\230\346\263\242/photo/2021-6-19 14-34-54.JPG" "b/\345\210\230\346\263\242/photo/2021-6-19 14-34-54.JPG" new file mode 100644 index 0000000000000000000000000000000000000000..5008f48c761e3bcc4ef85f8536e82da1130c4b2e Binary files /dev/null and "b/\345\210\230\346\263\242/photo/2021-6-19 14-34-54.JPG" differ diff --git "a/\345\210\230\346\263\242/photo/2021-6-19 15-12-17.JPG" "b/\345\210\230\346\263\242/photo/2021-6-19 15-12-17.JPG" new file mode 100644 index 0000000000000000000000000000000000000000..d6b549231312a3b17c43b533d1cdf5c8c04277d7 Binary files /dev/null and "b/\345\210\230\346\263\242/photo/2021-6-19 15-12-17.JPG" differ diff --git "a/\345\210\230\346\263\242/photo/2021-6-19 15-25-6.JPG" "b/\345\210\230\346\263\242/photo/2021-6-19 15-25-6.JPG" new file mode 100644 index 0000000000000000000000000000000000000000..0419929bd941b21417f8e86fc6f010075a9b25e6 Binary files /dev/null and "b/\345\210\230\346\263\242/photo/2021-6-19 15-25-6.JPG" differ diff --git "a/\345\210\230\346\263\242/photo/2021-6-19 15-35-48.JPG" "b/\345\210\230\346\263\242/photo/2021-6-19 15-35-48.JPG" new file mode 100644 index 0000000000000000000000000000000000000000..53126d5d7e9d5ab74bc8925ed4ff333b4f55a11a Binary files /dev/null and "b/\345\210\230\346\263\242/photo/2021-6-19 15-35-48.JPG" differ