vue开发-06-参数传递、重定向


1、.

传参

:to="{name:'UserList',params:{id:1}}"
path:'/ddd/dd/:id'

取参

<div>
    {{$route.params.id}}
</div>

2、.

使用 props解耦

传参

:to="{name:'UserList',params:{content:'内容显示'}}"
path: '/user/list/:content',
        name: 'UserList',
        props:true,

取参

export default {
        name: "UserList",
        props:['content']
    }
{{content}}

3、.

重定向

redirect:/Main


文章作者: liuminkai
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 liuminkai !
评论
 上一篇
vue开发-07-404、路由钩子 vue开发-07-404、路由钩子
路由模式有两种 hash:路径带#符号 history:路径不带# mode:'history' 404 notfound.vue path: '*'路由钩子 beforeRouteEnter 进入路
2020-08-11
下一篇 
vue开发-05-嵌套路由 vue开发-05-嵌套路由
嵌套路由.1、什么是嵌套路由.嵌套路由又称子路由,在实际应用中,通常由多层嵌套的组件组合而成。同样地,URL中各段动态路径也按某种结构对应嵌套的各层组件,列如: 通俗来讲,就一个组件中可以含有一个类似于iframe的窗口,这个窗口就是有子路
2020-08-10
  目录