1.动态路由传值
1.在components目录下新建vContent.vue组件
<template>
{{msg}}
$route.params);//获取动态路由传值
}
}
</script>
<style lang="scss" scoped>
h2{
color: red;
}
</style>
动态路由传值:
1.配置动态路由
配置路由
const routes=[
{path:'/vcontent/:aid',component:vContent}, //动态路由
]
2.在对应的页面
$route.params //获取动态路由传过来的值
2.get传值
1.在components目录下新建Goods.vue组件
<template>
Vue常用传值方式、父传子、子传父、非父子组件传值