Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

vue-router笔记 #56

Open
GH1995 opened this issue Mar 15, 2020 · 8 comments
Open

vue-router笔记 #56

GH1995 opened this issue Mar 15, 2020 · 8 comments

Comments

@GH1995
Copy link
Owner

GH1995 commented Mar 15, 2020

vue-router用来构建SPA

<router-link></router-link>或者`this.$Router.push({path:""})
<router-view></router-view>

router-link 跳转标签
router-view组件渲染

@GH1995
Copy link
Owner Author

GH1995 commented Mar 15, 2020

动态路由匹配

什么是动态路由?
image

GoodsList.vue

<span>{{$route.params.goodsId}}</span>   
localhost:8080/#/goods/sdf89/user/admin

image

localhost:8080/goods/sdf89/user/admin

image

@GH1995
Copy link
Owner Author

GH1995 commented Mar 15, 2020

嵌套路由

@ -> src 目录

image

子路由要写绝对地址
image

@GH1995
Copy link
Owner Author

GH1995 commented Mar 15, 2020

编程式路由

image

image

image
非params,组件和组件之间

@GH1995
Copy link
Owner Author

GH1995 commented Mar 15, 2020

命名路由和命名视图

什么是命名路由和命名视图?

  • 给路由定义不同的名字,根据名字进行匹配
  • 给不同的 router-view定义名字,通过名字进行对应组件的渲染

image
必须使用v- bind:to

image

image

@GH1995
Copy link
Owner Author

GH1995 commented Mar 15, 2020

vue-Resource基础介绍

image

image

image

@GH1995
Copy link
Owner Author

GH1995 commented Mar 15, 2020

image

image

@GH1995
Copy link
Owner Author

GH1995 commented Mar 15, 2020

axios基础介绍

image

image

并没有引入页面,只是暴露一个全局变量
image

@GH1995
Copy link
Owner Author

GH1995 commented Mar 15, 2020

第二个直接是数据,第三个参数是选项

image

image

全局拦截

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant