zoukankan      html  css  js  c++  java
  • Vue 动态路由传值

    一.动态路由传值

    1.配置动态路由;

    const routes = [
    //动态路由路径参数以:开头
    { path: '/Content/:aid', component:Content},
    ]
    2.
    <router-link :to="'/Shopcontent/'+key">
    {{key}}--{{item}}
    </router-link>
    直接在路径后来设置要传的值

    3..在对应的页面通过

    this.$route.paramshu获取动态路由的值;
    --------------------------------------------------------------------------------------------------------------
    二.get传值
    1.配置路由
    const routes = [
    { path: '/Content', component:Content},
    ]
    2.
    <router-link :to="'/Shopcontent?aid='+key">
    {{key}}--{{item}}
    </router-link>
    在<ruter-link>中通过?来传值

    3.在对应的页面通过

    this.$route.paramshu获取动由的值;
  • 相关阅读:
    Scala-文件操作
    python-数字
    python-访问模型
    scala-包
    Scala对象
    Scala-类
    sql存储过程
    sql视图
    sql基本语句
    sql中级语句
  • 原文地址:https://www.cnblogs.com/changedman/p/9199623.html
Copyright © 2011-2022 走看看