cccicl
cccicl
发布于 3个月前

vue 路由传参

this.$router.push({
        name: "roomDetails",
        params: {
          companyId: companyId,
          id: id,
          type: "Reserve"
     }
 });

router.js 里对应配置,否则刷新页面参数会消失

{  
  path: "/roomDetails/:companyId/:id/:type",
  component: () => import("./views/life/roomDetails.vue"),
  name: "roomDetails"
 }

接受参数

this.$route.params.id
Vue
©2020 edoou.com   京ICP备16001874号-3